Miscellaneous
0
Views
0
Downloads
0
Favorites
FLOAT#Data
//+------------------------------------------------------------------+
//| FLOAT#Data.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Float converted from MT3 to MT4"
#property link "http://www.4Africa.net/4meta/"
#property link "Data Indicator window by cja"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DarkSlateGray
#property indicator_color2 Red
extern int float=100,use_fibos=0,Backtesting=0;
string short_name;
double f,c1,high_bar,Low_bar,bars_high,bars_low;
double cumulativeV,FLOATV,cumulativeV2,loopbegin2,swing;
double swingv,loopbegin1,cnt,prevbars;
double newcv,CV,CV2;
double fib23,fib38,fib50,fib62,fib76;
double dinap0,dinap1,dinap2,dinap3,dinap4,dinap5;
double CVL,CVL1,CVL2,CVL3,CVL4;
double Buffer1[];
double Buffer2[];
bool first = true , first1 = true;
int shift,swing_time;
int cvstart,cvend,bar;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(2);
ObjectDelete("swingtop");
ObjectDelete("swingbottom");
ObjectDelete( "fib23" );
ObjectDelete( "fib38" );
ObjectDelete( "fib50" );
ObjectDelete( "fib62" );
ObjectDelete( "fib76" );
ObjectDelete( "fib23t" );
ObjectDelete( "fib38t" );
ObjectDelete( "fib50t" );
ObjectDelete( "fib62t" );
ObjectDelete( "fib76t" );
ObjectDelete( "dinap0" );
ObjectDelete( "dinap1" );
ObjectDelete( "dinap2" );
ObjectDelete( "dinap3" );
ObjectDelete( "dinap4" );
ObjectDelete( "dinap5" );
ObjectDelete("CVSTART");
ObjectDelete("CVEND");
ObjectDelete("swingend");
ObjectDelete("swingend2");
ObjectDelete("swingend3");
ObjectDelete("swingend4");
ObjectDelete("swingend5");
ObjectDelete("swingend6");
ObjectDelete("swingend7");
ObjectDelete("swingend8");
ObjectDelete("swingend9");
IndicatorShortName("Float DATA");//("Float ("+float+") ");
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexBuffer(0,Buffer1);
SetIndexDrawBegin(0,Buffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1 );
SetIndexBuffer(1,Buffer2);
SetIndexDrawBegin(1,Buffer2);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("swingtop");
ObjectDelete("swingbottom");
ObjectDelete( "fib23" );
ObjectDelete( "fib38" );
ObjectDelete( "fib50" );
ObjectDelete( "fib62" );
ObjectDelete( "fib76" );
ObjectDelete( "fib23t" );
ObjectDelete( "fib38t" );
ObjectDelete( "fib50t" );
ObjectDelete( "fib62t" );
ObjectDelete( "fib76t" );
ObjectDelete( "dinap0" );
ObjectDelete( "dinap1" );
ObjectDelete( "dinap2" );
ObjectDelete( "dinap3" );
ObjectDelete( "dinap4" );
ObjectDelete( "dinap5" );
ObjectDelete("CVSTART");
ObjectDelete("CVEND");
ObjectDelete("swingend");
ObjectDelete("swingend2");
ObjectDelete("swingend3");
ObjectDelete("swingend4");
ObjectDelete("swingend5");
ObjectDelete("swingend6");
ObjectDelete("swingend7");
ObjectDelete("swingend8");
ObjectDelete("swingend9");
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1); // Exit if na data
cumulativeV=0;
cumulativeV2=0;
int SetLoopCount=0;
if( Bars < prevbars || Bars-prevbars>1 ) //If 1
{
first = True;
first1 = True;
prevbars = Bars;
FLOATV=0;
if( first ) //if 2
{
loopbegin1 = Bars-float-1;
loopbegin2 = Bars-float-1;
first = False;
loopbegin1 = loopbegin1+1;
for( shift=loopbegin1;shift>=0;shift--) // for 1
{
//find high and low
high_bar = High[Highest(NULL,0,MODE_HIGH,float,1)];
Low_bar = Low[Lowest(NULL,0,MODE_LOW,float,1)];
//find bar counts
bars_high = Highest(NULL,0,MODE_HIGH,float,1);
bars_low = Lowest(NULL,0,MODE_LOW,float,1);
//find swing price differance
swing = High[Highest(NULL,0,MODE_HIGH,float,1)] - Low[Lowest(NULL,0,MODE_LOW,float,1)];
//find float time barcount
swing_time = MathAbs(bars_low-bars_high);
//find cumulative volume for float period
if( bars_high < bars_low )
{
cvstart=bars_low;
cvend=bars_high;
}
else
{
cvstart=bars_high;
cvend=bars_low;
}
if( first1 && FLOATV == 0 ) // if 3
{
for( shift=cvstart;shift>=cvend;shift--)
{
FLOATV=FLOATV+Volume[shift];
first1 = False;}
}
}
//find cumulative volume since last turnover
for( shift=cvstart;shift>=0;shift--) // for 2
{
cumulativeV=cumulativeV+Volume[shift];
if( cumulativeV >= FLOATV )
{
cumulativeV=0;
}
Buffer1[shift] = cumulativeV*0.0001; //Blue
Buffer2[shift] = FLOATV*0.0001; //Red
// Float DATA window code
double myFirstValue = high_bar;//High bar Price
double mySecondValue = Low_bar;//Low bar Price
double myThirdValue = bars_high*0.0001;//# of bars ago
double myForthValue = bars_low*0.0001;//# of bars ago
double myFifthValue = FLOATV*0.0001; //Float volume
double mySixthValue = swing_time; // Float Time was
double mySeventhValue = FLOATV*0.0001 - cumulativeV*0.0001; //Float Vol left
double myEigthValue = float; //float period
ObjectCreate("Float", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float",DoubleToStr(myFirstValue,Digits),18, "Arial", PaleTurquoise);
ObjectSet("Float", OBJPROP_CORNER, 0);
ObjectSet("Float", OBJPROP_XDISTANCE, 120);
ObjectSet("Float", OBJPROP_YDISTANCE, 10);
ObjectCreate("Float2", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float2",DoubleToStr(mySecondValue,Digits),18, "Arial", PaleTurquoise);
ObjectSet("Float2", OBJPROP_CORNER, 0);
ObjectSet("Float2", OBJPROP_XDISTANCE, 120);
ObjectSet("Float2", OBJPROP_YDISTANCE, 35);
ObjectCreate("Float3", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float3","HIGH Bar =",14, "tahoma", Yellow);
ObjectSet("Float3", OBJPROP_CORNER, 0);
ObjectSet("Float3", OBJPROP_XDISTANCE, 5);
ObjectSet("Float3", OBJPROP_YDISTANCE, 12);
ObjectCreate("Float4", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float4","LOW Bar =",14, "tahoma", Yellow);
ObjectSet("Float4", OBJPROP_CORNER, 0);
ObjectSet("Float4", OBJPROP_XDISTANCE, 5);
ObjectSet("Float4", OBJPROP_YDISTANCE, 35);
ObjectCreate("Float5", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float5",DoubleToStr(myThirdValue,Digits),14, "Arial", Red);
ObjectSet("Float5", OBJPROP_CORNER, 0);
ObjectSet("Float5", OBJPROP_XDISTANCE, 220);
ObjectSet("Float5", OBJPROP_YDISTANCE, 15);
ObjectCreate("Float6", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float6",DoubleToStr(myForthValue,Digits),14, "Arial", Red);
ObjectSet("Float6", OBJPROP_CORNER, 0);
ObjectSet("Float6", OBJPROP_XDISTANCE, 220);
ObjectSet("Float6", OBJPROP_YDISTANCE, 35);
ObjectCreate("Float7", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float7","+",14, "Arial", CadetBlue);
ObjectSet("Float7", OBJPROP_CORNER, 0);
ObjectSet("Float7", OBJPROP_XDISTANCE, 200);
ObjectSet("Float7", OBJPROP_YDISTANCE, 13);
ObjectCreate("Float8", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float8","+",14, "Arial", CadetBlue);
ObjectSet("Float8", OBJPROP_CORNER, 0);
ObjectSet("Float8", OBJPROP_XDISTANCE, 200);
ObjectSet("Float8", OBJPROP_YDISTANCE, 33);
ObjectCreate("Float9", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float9",DoubleToStr(myFifthValue,Digits),14, "Arial", Coral);
ObjectSet("Float9", OBJPROP_CORNER, 0);
ObjectSet("Float9", OBJPROP_XDISTANCE, 410);
ObjectSet("Float9", OBJPROP_YDISTANCE, 40);
ObjectCreate("Float10", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float10","Float Volume =",9, "tahoma", Turquoise);
ObjectSet("Float10", OBJPROP_CORNER, 0);
ObjectSet("Float10", OBJPROP_XDISTANCE, 300);
ObjectSet("Float10", OBJPROP_YDISTANCE, 45);
ObjectCreate("Float11", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float11",DoubleToStr(mySixthValue,Digits-4),14, "Arial",MediumPurple);
ObjectSet("Float11", OBJPROP_CORNER, 0);
ObjectSet("Float11", OBJPROP_XDISTANCE, 410);
ObjectSet("Float11", OBJPROP_YDISTANCE, 10);
ObjectCreate("Float12", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float12","Bars",9, "tahoma", CadetBlue);
ObjectSet("Float12", OBJPROP_CORNER, 0);
ObjectSet("Float12", OBJPROP_XDISTANCE,445);
ObjectSet("Float12", OBJPROP_YDISTANCE, 15);
ObjectCreate("Float13", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float13","Float Time =",9, "tahoma", Turquoise);
ObjectSet("Float13", OBJPROP_CORNER, 0);
ObjectSet("Float13", OBJPROP_XDISTANCE,300);
ObjectSet("Float13", OBJPROP_YDISTANCE, 15);
ObjectCreate("Float14", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float14",DoubleToStr(mySeventhValue,Digits),14, "Arial",Coral);
ObjectSet("Float14", OBJPROP_CORNER, 0);
ObjectSet("Float14", OBJPROP_XDISTANCE, 410);
ObjectSet("Float14", OBJPROP_YDISTANCE, 25);
ObjectCreate("Float15", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float15","Float Vol left =",9, "tahoma", Turquoise);
ObjectSet("Float15", OBJPROP_CORNER, 0);
ObjectSet("Float15", OBJPROP_XDISTANCE,300);
ObjectSet("Float15", OBJPROP_YDISTANCE, 30);
ObjectCreate("Float16", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float16","Float Period",9, "tahoma", Turquoise);
ObjectSet("Float16", OBJPROP_CORNER, 0);
ObjectSet("Float16", OBJPROP_XDISTANCE,790);
ObjectSet("Float16", OBJPROP_YDISTANCE, 10);
ObjectCreate("Float17", OBJ_LABEL, WindowFind("Float DATA"), 0, 0);
ObjectSetText("Float17",DoubleToStr(myEigthValue,Digits-4),14, "Arial",Coral);
ObjectSet("Float17", OBJPROP_CORNER, 0);
ObjectSet("Float17", OBJPROP_XDISTANCE, 866);
ObjectSet("Float17", OBJPROP_YDISTANCE, 8);
//End Float DATA window code
//Comment(
//"\n","high was ",high_bar," ",bars_high," bars ago", // Was just bars_high
//"\n","Low was ",Low_bar," ",bars_low," bars ago","\n",// Was just bars_Low
//"\n","Float time was = ", swing_time," bars",
//"\n","Float Vol. left = ",FLOATV-cumulativeV,
//"\n","Float Volume = ",FLOATV,
//);
ObjectDelete("swingtop");
ObjectCreate("swingtop", OBJ_TREND , 0, Time[cvstart],high_bar,Time[1],high_bar);
ObjectSet("swingtop" , OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("swingtop" , OBJPROP_COLOR , Blue );
ObjectSet("swingtop" , OBJPROP_RAY , 0 );
ObjectSet("swingtop" , OBJPROP_WIDTH , 1 );
ObjectDelete("swingbottom");
ObjectCreate("swingbottom", OBJ_TREND , 0, Time[cvstart],Low_bar,Time[1],Low_bar);
ObjectSet("swingbottom" , OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("swingbottom" , OBJPROP_COLOR , Blue );
ObjectSet("swingbottom" , OBJPROP_RAY , 0 );
ObjectSet("swingbottom" , OBJPROP_WIDTH , 1 );
//fibos
if( use_fibos == 1 )
{
ObjectDelete( "fib23" );
ObjectDelete( "fib38" );
ObjectDelete( "fib50" );
ObjectDelete( "fib62" );
ObjectDelete( "fib76" );
ObjectDelete( "dinap0" );
ObjectDelete( "dinap1" );
ObjectDelete( "dinap2" );
ObjectDelete( "dinap3" );
ObjectDelete( "dinap4" );
ObjectDelete( "dinap5" );
fib23=((high_bar-Low_bar)*0.236)+Low_bar;
fib38=((high_bar-Low_bar)*0.382)+Low_bar;
fib50=((high_bar-Low_bar)/2)+Low_bar;
fib62=((high_bar-Low_bar)*0.618)+Low_bar;
fib76=((high_bar-Low_bar)*0.764)+Low_bar;
dinap0=(Low_bar+fib23)/2;
dinap1=(fib23+fib38)/2;
dinap2=(fib38+fib50)/2;
dinap3=(fib50+fib62)/2;
dinap4=(fib62+fib76)/2;
dinap5=(high_bar+fib76)/2;
ObjectCreate("fib23", OBJ_TREND , 0, Time[cvstart],fib23,Time[1],fib23 );
ObjectSet("fib23" , OBJPROP_STYLE, STYLE_DASHDOTDOT );
ObjectSet("fib23" , OBJPROP_COLOR , DarkTurquoise );
ObjectSet("fib23" , OBJPROP_RAY , 0 );
ObjectSet("fib23" , OBJPROP_WIDTH , 1 );
ObjectCreate("fib23t", OBJ_TEXT , 0, Time[1],fib23 );
ObjectSetText("fib23t" , "23.6", 8 , "Arial", DarkTurquoise);
ObjectCreate("fib38", OBJ_TREND , 0, Time[cvstart],fib38,Time[1],fib38 );
ObjectSet("fib38" , OBJPROP_STYLE, STYLE_DASHDOTDOT );
ObjectSet("fib38" , OBJPROP_COLOR , DarkTurquoise );
ObjectSet("fib38" , OBJPROP_RAY , 0 );
ObjectSet("fib38" , OBJPROP_WIDTH , 1 );
ObjectCreate("fib38t", OBJ_TEXT , 0, Time[1],fib38 );
ObjectSetText("fib38t" , "38.2", 8 , "Arial", DarkTurquoise);
ObjectCreate("fib50", OBJ_TREND , 0, Time[cvstart],fib50,Time[1],fib50 );
ObjectSet("fib50" , OBJPROP_STYLE, STYLE_DASHDOTDOT );
ObjectSet("fib50" , OBJPROP_COLOR , Red );
ObjectSet("fib50" , OBJPROP_RAY , 0 );
ObjectSet("fib50" , OBJPROP_WIDTH , 1 );
ObjectCreate("fib50t", OBJ_TEXT , 0, Time[1],fib50 );
ObjectSetText("fib50t" , "50.0", 8 , "Arial", Red);
ObjectCreate("fib62", OBJ_TREND , 0, Time[cvstart],fib62,Time[1],fib62 );
ObjectSet("fib62" , OBJPROP_STYLE, STYLE_DASHDOTDOT );
ObjectSet("fib62" , OBJPROP_COLOR , DarkTurquoise );
ObjectSet("fib62" , OBJPROP_RAY , 0 );
ObjectSet("fib62" , OBJPROP_WIDTH , 1 );
ObjectCreate("fib62t", OBJ_TEXT , 0, Time[1],fib62 );
ObjectSetText("fib62t" , "61.8", 8 , "Arial", DarkTurquoise);
ObjectCreate("fib76", OBJ_TREND , 0, Time[cvstart],fib76,Time[1],fib76 );
ObjectSet("fib76" , OBJPROP_STYLE, STYLE_DASHDOTDOT);
ObjectSet("fib76" , OBJPROP_COLOR , DarkTurquoise );
ObjectSet("fib76" , OBJPROP_RAY , 0 );
ObjectSet("fib76" , OBJPROP_WIDTH , 1 );
ObjectCreate("fib76t", OBJ_TEXT , 0, Time[1],fib76 );
ObjectSetText("fib76t" , "76.4", 8 , "Arial", DarkTurquoise);
//ObjectCreate("dinap0", OBJ_TREND , 0, Time[cvstart],dinap0,Time[1],dinap0 );
//ObjectSet("dinap0" , OBJPROP_STYLE, STYLE_DOT );
//ObjectSet("dinap0" , OBJPROP_COLOR , MidnightBlue );
//ObjectSet("dinap0" , OBJPROP_RAY , 0 );
//ObjectSet("dinap0" , OBJPROP_WIDTH , 1 );
//ObjectCreate("dinap1", OBJ_TREND , 0, Time[cvstart],dinap1,Time[1],dinap1 );
//ObjectSet("dinap1" , OBJPROP_STYLE, STYLE_DOT );
//ObjectSet("dinap1" , OBJPROP_COLOR , MidnightBlue);
//ObjectSet("dinap1" , OBJPROP_RAY , 0 );
//ObjectSet("dinap1" , OBJPROP_WIDTH , 1 );
//ObjectCreate("dinap2", OBJ_TREND , 0, Time[cvstart],dinap2,Time[1],dinap2 );
//ObjectSet("dinap2" , OBJPROP_STYLE, STYLE_DOT );
//ObjectSet("dinap2" , OBJPROP_COLOR , MidnightBlue );
//ObjectSet("dinap2" , OBJPROP_RAY , 0 );
//ObjectSet("dinap2" , OBJPROP_WIDTH , 1 );
//ObjectCreate("dinap3", OBJ_TREND , 0, Time[cvstart],dinap3,Time[1],dinap3 );
//ObjectSet("dinap3" , OBJPROP_STYLE, STYLE_DOT );
//ObjectSet("dinap3" , OBJPROP_COLOR , MidnightBlue );
//ObjectSet("dinap3" , OBJPROP_RAY , 0 );
//ObjectSet("dinap3" , OBJPROP_WIDTH , 1 );
//ObjectCreate("dinap4", OBJ_TREND , 0, Time[cvstart],dinap4,Time[1],dinap4 );
//ObjectSet("dinap4" , OBJPROP_STYLE, STYLE_DOT );
//ObjectSet("dinap4" , OBJPROP_COLOR , MidnightBlue );
//ObjectSet("dinap4" , OBJPROP_RAY , 0 );
//ObjectSet("dinap4" , OBJPROP_WIDTH , 1 );
//ObjectCreate("dinap5", OBJ_TREND , 0, Time[cvstart],dinap5,Time[1],dinap5 );
//ObjectSet("dinap5" , OBJPROP_STYLE, STYLE_DOT );
//ObjectSet("dinap5" , OBJPROP_COLOR , MidnightBlue);
//ObjectSet("dinap5" , OBJPROP_RAY , 0 );
//ObjectSet("dinap5" , OBJPROP_WIDTH , 1 );
}
else
{
ObjectDelete( "fib23" );
ObjectDelete( "fib38" );
ObjectDelete( "fib50" );
ObjectDelete( "fib62" );
ObjectDelete( "fib76" );
ObjectDelete( "dinap0" );
ObjectDelete( "dinap1" );
ObjectDelete( "dinap2" );
ObjectDelete( "dinap3" );
ObjectDelete( "dinap4" );
ObjectDelete( "dinap5" );
}
//vert. float lines. these draw the lines that calculate the float
//if you change "trendline" to "Vline" it will draw through oscillators too.might be fun
ObjectDelete("CVSTART");
ObjectCreate("CVSTART", OBJ_VLINE , 0, Time[cvstart],high_bar,Time[cvstart],Low_bar*Point);
ObjectSet("CVSTART" , OBJPROP_STYLE, STYLE_DOT);
ObjectSet("CVSTART" , OBJPROP_COLOR , Blue );
ObjectSet("CVSTART" , OBJPROP_RAY , 0 );
ObjectSet("CVSTART" , OBJPROP_WIDTH , 1 );
ObjectDelete("CVEND");
ObjectCreate("CVEND", OBJ_VLINE , 0, Time[cvend],high_bar,Time[cvend],Low_bar*Point);
ObjectSet("CVEND" , OBJPROP_STYLE, STYLE_DOT);
ObjectSet("CVEND" , OBJPROP_COLOR , Red );
ObjectSet("CVEND" , OBJPROP_RAY , 0 );
ObjectSet("CVEND" , OBJPROP_WIDTH , 1 );
//vert float predictions. These are only time based.
//see blue histogram for real float values.
//if you change "trendline" to "Vline" it will draw through oscillators too.might be fun
//if ( cvend-swing_time > 0 )
//{
//ObjectDelete("swingend");
//ObjectCreate("swingend", OBJ_TREND , 0, Time[(cvend-swing_time)+5],high_bar,Time[cvend-swing_time+5],Low_bar);
//ObjectSet("swingend" , OBJPROP_STYLE, STYLE_DOT);
//ObjectSet("swingend" , OBJPROP_COLOR , DarkSlateGray );
//ObjectSet("swingend" , OBJPROP_RAY , 0 );
//ObjectSet("swingend" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend");
//if( cvend-(swing_time*2)>0 )
//{
//ObjectDelete("swingend2");
//ObjectCreate("swingend2", OBJ_TREND , 0, Time[(cvend-(swing_time*2))+5],high_bar,Time[cvend-(swing_time*2)+5],Low_bar);
//ObjectSet("swingend2" , OBJPROP_STYLE, STYLE_DOT);
//ObjectSet("swingend2" , OBJPROP_COLOR , DarkSlateGray );
//ObjectSet("swingend2", OBJPROP_RAY , 0 );
//ObjectSet("swingend2" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend2");
//if( cvend-(swing_time*3)>0 )
//{
//ObjectDelete("swingend3");
// ObjectCreate("swingend3", OBJ_TREND , 0, Time[(cvend-(swing_time*3))+5],high_bar,Time[cvend-(swing_time*3)+5],Low_bar);
// ObjectSet("swingend3" , OBJPROP_STYLE, STYLE_DOT);
// ObjectSet("swingend3" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend3", OBJPROP_RAY , 0 );
// ObjectSet("swingend3" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend3");
//if( cvend-(swing_time*4)>0 )
//{
// ObjectDelete("swingend4");
// ObjectCreate("swingend4", OBJ_TREND , 0, Time[(cvend-(swing_time*4))+5],high_bar,Time[cvend-(swing_time*4)+5],Low_bar);
// ObjectSet("swingend4" , OBJPROP_STYLE, STYLE_DOT);
// ObjectSet("swingend4" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend4", OBJPROP_RAY , 0 );
// ObjectSet("swingend4" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend4");
//if( cvend-(swing_time*5)>0 )
//{
// ObjectDelete("swingend5");
// ObjectCreate("swingend5", OBJ_TREND , 0, Time[(cvend-(swing_time*5))+5],high_bar,Time[cvend-(swing_time*5)+5],Low_bar);
// ObjectSet("swingend5" , OBJPROP_STYLE, STYLE_DOT);
// ObjectSet("swingend5" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend5", OBJPROP_RAY , 0 );
// ObjectSet("swingend5" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend5");
//if( cvend-(swing_time*6)>0 )
//{
// ObjectDelete("swingend6");
// ObjectCreate("swingend6", OBJ_TREND , 0, Time[cvend-(swing_time*6)+5],high_bar,Time[cvend-(swing_time*6)+5],Low_bar);
//ObjectSet("swingend6" , OBJPROP_STYLE, STYLE_DOT);
//ObjectSet("swingend6" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend6", OBJPROP_RAY , 0 );
// ObjectSet("swingend6" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend6");
//if( cvend-(swing_time*7)>0 )
//{
// ObjectDelete("swingend7");
// ObjectCreate("swingend7", OBJ_TREND , 0, Time[cvend-(swing_time*7)+5],high_bar,Time[cvend-(swing_time*7)+5],Low_bar);
// ObjectSet("swingend7" , OBJPROP_STYLE, STYLE_DOT);
// ObjectSet("swingend7" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend7", OBJPROP_RAY , 0 );
// ObjectSet("swingend7" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend7");
//if( cvend-(swing_time*8)>0 )
//{
// ObjectDelete("swingend8");
// ObjectCreate("swingend8", OBJ_TREND , 0, Time[cvend-(swing_time*8)+5],high_bar,Time[cvend-(swing_time*8)+5],Low_bar);
// ObjectSet("swingend8" , OBJPROP_STYLE, STYLE_DOT);
// ObjectSet("swingend8" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend8", OBJPROP_RAY , 0 );
// ObjectSet("swingend8" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend8");
//if( cvend-(swing_time*9)>0 )
//{
// ObjectDelete("swingend9");
// ObjectCreate("swingend9", OBJ_TREND , 0, Time[cvend-(swing_time*9)+5],high_bar,Time[cvend-(swing_time*9)+5],Low_bar);
// ObjectSet("swingend9" , OBJPROP_STYLE, STYLE_DOT);
// ObjectSet("swingend9" , OBJPROP_COLOR , DarkSlateGray );
// ObjectSet("swingend9", OBJPROP_RAY , 0 );
// ObjectSet("swingend9" , OBJPROP_WIDTH , 1 );
//}
//else ObjectDelete("swingend9");
//comment out anything you"re not using it will help with speed.
if( Backtesting == 1 )
{
GlobalVariableSet("fib23",fib23);
GlobalVariableSet("fib38",fib38);
GlobalVariableSet("fib50",fib50);
GlobalVariableSet("fib62",fib62);
GlobalVariableSet("fib76",fib76);
GlobalVariableSet("dinap0",dinap0);
GlobalVariableSet("dinap1",dinap1);
GlobalVariableSet("dinap2",dinap2);
GlobalVariableSet("dinap3",dinap3);
GlobalVariableSet("dinap4",dinap4);
GlobalVariableSet("dinap5",dinap5);
GlobalVariableSet("swingtop",high_bar);
GlobalVariableSet("swingbottom",Low_bar);
GlobalVariableSet("CVSTART",cvstart);
GlobalVariableSet("CVEND",cvend);
GlobalVariableSet("FLOATV",FLOATV);
GlobalVariableSet("cumulativeV",cumulativeV);
GlobalVariableSet("swing_time",swing_time);
GlobalVariableSet("bars_high",bars_high);
GlobalVariableSet("bars_low",bars_low);
if( cvend-swing_time>0 )
GlobalVariableSet("swingend",(cvend-swing_time)+5);
if( cvend-(swing_time*2)>0 )
GlobalVariableSet("swingend2",cvend-(swing_time*2)+5);
if( cvend-(swing_time*3)>0 )
GlobalVariableSet("swingend3",cvend-(swing_time*3)+5);
if( cvend-(swing_time*4)>0 )
GlobalVariableSet("swingend4",cvend-(swing_time*4)+5);
if( cvend-(swing_time*5)>0 )
GlobalVariableSet("swingend5",cvend-(swing_time*5)+5);
if( cvend-(swing_time*6)>0 )
GlobalVariableSet("swingend6",cvend-(swing_time*6)+5);
if( cvend-(swing_time*7)>0 )
GlobalVariableSet("swingend7",cvend-(swing_time*7)+5);
if( cvend-(swing_time*8)>0 )
GlobalVariableSet("swingend8",cvend-(swing_time*8)+5);
if( cvend-(swing_time*9)>0 )
GlobalVariableSet("swingend9",cvend-(swing_time*9)+5);
} // end Backtesting
}
}
}
return(0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---