Moving Average Based Trading (Advanced)
//Moving Average Based Trading Advanced version
SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
SetChartOptions(0,chartShowArrows|chartShowDates);
showsig=ParamList("Show Signals","YES|NO");
Showprice=ParamList("Show Buy/Sell Prices","YES|NO");
showsig=ParamList("Show Signals","YES|NO");
Showprice=ParamList("Show Buy/Sell Prices","YES|NO");
Plot( C, "Close", ParamColor("Color", colorBlack), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
period = Param("Period", 13, 1, 240, 1);
mult = Param("Multiplier", 2.21, 0, 3, 0.01);
A=EMA (RSI(14),5);
B=EMA (RSI(21),5);
mult = Param("Multiplier", 2.21, 0, 3, 0.01);
A=EMA (RSI(14),5);
B=EMA (RSI(21),5);
f=ATR(period);
x=5;
VS[0] = Close[0];
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;
for( i = period+1; i < BarCount; i++ )
{
x=5;
VS[0] = Close[0];
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;
for( i = period+1; i < BarCount; i++ )
{
vs[i] = vs[i-1];
trend[i] = trend[i-1];
highC[i] = HighC[i-1];
lowc[i] = lowc[i-1];
trend[i] = trend[i-1];
highC[i] = HighC[i-1];
lowc[i] = lowc[i-1];
if ((trend[i]>=0) AND ( C[i] <VS[i]))
{
trend[i] =-1;
HighC[i] = C[i];
lowc[i] = C[i];
}
{
trend[i] =-1;
HighC[i] = C[i];
lowc[i] = C[i];
}
if ((trend[i]<=0) AND (C[i] >VS[i]))
{
trend[i]=1;
HighC[i] = C[i];
lowc[i] = C[i];
}
{
trend[i]=1;
HighC[i] = C[i];
lowc[i] = C[i];
}
if (trend[i]==-1)
{
if (C[i]<lowc[i]) lowc[i] = C[i];
VS[i]= lowc[i]+ (mult*f[i]);
}
{
if (C[i]<lowc[i]) lowc[i] = C[i];
VS[i]= lowc[i]+ (mult*f[i]);
}
if (trend[i]==1)
{
if (C[i]>HighC[i]) HighC[i] = C[i];
VS[i]= HighC[i]-(mult*f[i]);
}
}
Pribbon=ParamList("Ribbon? ", "Yes|No");
if (Pribbon=="Yes")
{
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( trend==1, colorGreen, IIf( trend==-1, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
}
Pribbon=ParamList("Ribbon? ", "Yes|No");
if (Pribbon=="Yes")
{
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( trend==1, colorGreen, IIf( trend==-1, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
}
_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), IIf( C > O, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ), ParamStyle( "Style", styleHistogram | styleThick |styleOwnScale, maskHistogram ),7 );
_SECTION_END();
TrailStop = HHV( C - 2.1 * ATR(3), 7);
//trailstop=(IIf(!downtrend OR uptrend, trailstop, Null));
//Plot( trailstop , "Trailing stop", colorCustom12, 8);
//Plot( trailstop , "Trailing stop", colorCustom12, 8);
//Plot( IIf(shrttgt<TrailStop,trailstop,(shrttgt+trailstop)/2) , "Trailing stop", colorCustom11, 8);
TrailStop1 = LLV( C + 2.1 * ATR(3), 7);
//trailstop1=(IIf(!uptrend OR downtrend, trailstop1, Null));
//Plot( TrailStop1, "Trailing stop1", colorBlack, 8);
_SECTION_BEGIN("GMMA");
a=C;
g=(EMA(Close,3) * (2 / 4 - 1)-EMA(Close,60) * (2 / 61 - 1)) / (2 /4- 2 /61);
e=Ref(g,-1);
Plot (EMA(a,3), "3ema", colorBlue,styleNoLabel);
Plot (EMA(a,5), "5ema", colorBlue,styleNoLabel);
Plot (EMA(a,8), "8ema", colorBlue,styleNoLabel);
Plot (EMA(a,10), "10ema", colorBlue,styleNoLabel);
Plot (EMA(a,12), "12ema", colorBlue,styleNoLabel);
Plot (EMA(a,15), "15ema", colorBlue,styleNoLabel);
a=C;
g=(EMA(Close,3) * (2 / 4 - 1)-EMA(Close,60) * (2 / 61 - 1)) / (2 /4- 2 /61);
e=Ref(g,-1);
Plot (EMA(a,3), "3ema", colorBlue,styleNoLabel);
Plot (EMA(a,5), "5ema", colorBlue,styleNoLabel);
Plot (EMA(a,8), "8ema", colorBlue,styleNoLabel);
Plot (EMA(a,10), "10ema", colorBlue,styleNoLabel);
Plot (EMA(a,12), "12ema", colorBlue,styleNoLabel);
Plot (EMA(a,15), "15ema", colorBlue,styleNoLabel);
Plot (EMA(a,30), "30ema", colorRed,styleNoLabel);
Plot (EMA(a,35), "35ema", colorRed,styleNoLabel);
Plot (EMA(a,40), "40ema", colorRed,styleNoLabel);
Plot (EMA(a,45), "45ema", colorRed,styleNoLabel);
Plot (EMA(a,50), "50ema", colorRed,styleNoLabel);
Plot (EMA(a,55), "55ema", colorRed,styleNoLabel);
Plot (EMA(a,60), "60ema", colorRed,styleNoLabel);
//Plot(C,"close", colorBlack,styleCandle);
Plot (EMA(a,35), "35ema", colorRed,styleNoLabel);
Plot (EMA(a,40), "40ema", colorRed,styleNoLabel);
Plot (EMA(a,45), "45ema", colorRed,styleNoLabel);
Plot (EMA(a,50), "50ema", colorRed,styleNoLabel);
Plot (EMA(a,55), "55ema", colorRed,styleNoLabel);
Plot (EMA(a,60), "60ema", colorRed,styleNoLabel);
//Plot(C,"close", colorBlack,styleCandle);
Cond1=StochK(14)>StochD(14);
Cond2=StochK(14)<StochD(14);
Buy=Cross(EMA(C,15),EMA(C,60));
Sell=Cross(EMA(C,60),EMA(C,15));
Cond2=StochK(14)<StochD(14);
Buy=Cross(EMA(C,15),EMA(C,60));
Sell=Cross(EMA(C,60),EMA(C,15));
Filter = Buy OR Sell;
_SECTION_END();
AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);
Cond13=PDI()>MDI();
AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);
Cond13=PDI()>MDI();
_SECTION_END();
_SECTION_END();
_SECTION_BEGIN("my FIST");
Slowavg=Param("Slow Average",10,10,70,1);
Fastavg=Param("Fast Average",3,1,15,1);
gapx=Param("Tolerance",3,0,10,.001);
SPsignals=ParamList("Generate new Buy/Sells after SP","YES|NO");
n4=4;
Datex=DateNum();
Buy1=Cross(EMA(C,fastavg),EMA(C,slowavg));
Sell1=Cross(EMA(C,slowavg),EMA(C,fastavg));
Fastavg=Param("Fast Average",3,1,15,1);
gapx=Param("Tolerance",3,0,10,.001);
SPsignals=ParamList("Generate new Buy/Sells after SP","YES|NO");
n4=4;
Datex=DateNum();
Buy1=Cross(EMA(C,fastavg),EMA(C,slowavg));
Sell1=Cross(EMA(C,slowavg),EMA(C,fastavg));
EMA3=EMA(C,3);
EMA30=EMA(C,30);
Lastsig=0;
diff=5;
for (i=1;i<BarCount;i++)
{
if(Datex[i]!=Datex[i-1] AND Interval()<86400)
{
if(EMA3[i]> EMa30[i] ) buy1[i]=1;
if(EMA3[i]< EMA30[i] ) Sell1[i]=1;
}
if(Buy1[i])
{
if(Sell1[i-1])
{
Buy1[i]=0;
Sell1[i-1]=0;
}
}
if(Sell1[i])
{
if(Buy1[i-1])
{
Buy1[i-1]=0;
Sell1[i]=0;
}
}
}
gapema=abs(EMA(C,fastavg)-EMA(C,slowavg));
EMA30=EMA(C,30);
Lastsig=0;
diff=5;
for (i=1;i<BarCount;i++)
{
if(Datex[i]!=Datex[i-1] AND Interval()<86400)
{
if(EMA3[i]> EMa30[i] ) buy1[i]=1;
if(EMA3[i]< EMA30[i] ) Sell1[i]=1;
}
if(Buy1[i])
{
if(Sell1[i-1])
{
Buy1[i]=0;
Sell1[i-1]=0;
}
}
if(Sell1[i])
{
if(Buy1[i-1])
{
Buy1[i-1]=0;
Sell1[i]=0;
}
}
}
gapema=abs(EMA(C,fastavg)-EMA(C,slowavg));
Nowbuy=0;Nowsell=0;starti=0;Lastbuy=Lastsell=0;
avp=(O+C)/2;
for (i=1;i<BarCount;i++)
{
if(Datex[i]!=Datex[i-1])
{
Nowbuy=0;Nowsell=0;starti=0;Lastbuy=Lastsell=0;
}
if(Buy1[i] )
{
if (lastbuy==0)Nowbuy=1;
Nowsell=0;
Buy1[i]=0;
}
if(Sell1[i] )
{
Nowbuy=0;
if(Lastsell==0)Nowsell=1;
Sell1[i]=0;
}
if (Nowbuy==1 AND gapema[i]>gapx)
{
Buy1[i]=1;
Nowbuy=0;
Nowsell=0;
}
avp=(O+C)/2;
for (i=1;i<BarCount;i++)
{
if(Datex[i]!=Datex[i-1])
{
Nowbuy=0;Nowsell=0;starti=0;Lastbuy=Lastsell=0;
}
if(Buy1[i] )
{
if (lastbuy==0)Nowbuy=1;
Nowsell=0;
Buy1[i]=0;
}
if(Sell1[i] )
{
Nowbuy=0;
if(Lastsell==0)Nowsell=1;
Sell1[i]=0;
}
if (Nowbuy==1 AND gapema[i]>gapx)
{
Buy1[i]=1;
Nowbuy=0;
Nowsell=0;
}
if (Nowsell==1 AND gapema[i]>gapx )
{
Sell1[i]=1;
starti=i;
Nowsell=0;
Nowbuy=0;
}
if (Buy1[i])
{
Lastbuy=1;
Lastsell=0;
}
if (Sell1[i])
{
Lastbuy=0;
Lastsell=1;
}
{
Sell1[i]=1;
starti=i;
Nowsell=0;
Nowbuy=0;
}
if (Buy1[i])
{
Lastbuy=1;
Lastsell=0;
}
if (Sell1[i])
{
Lastbuy=0;
Lastsell=1;
}
}
slhigh=HHV(H,BarsSince(Buy1));
sllow=LLV(L,BarsSince(Sell1));
gapy=Param("SP",10,0,50,0.01);
Lastshort=0;priceatcover=priceatshort=0;Cover2=0;Lastcover=0;Sell2=0;Lastsell=newbuy=newshort=0;
for (i=1; i<BarCount-1;i++)
{
if(Datex[i]!=Datex[i-1] )
{
Lastshort=0;priceatsell=priceatcover=priceatshort=0;Lastcover=0;Lastsell=newbuy=newshort=0;
}
if (Sell1[i])
{
Lastshort=1;
Lastbuy=0;
Lastsell=0;
starti=i;
priceatshort=H[i];
sllow=LLV(L,BarsSince(Sell1));
gapy=Param("SP",10,0,50,0.01);
Lastshort=0;priceatcover=priceatshort=0;Cover2=0;Lastcover=0;Sell2=0;Lastsell=newbuy=newshort=0;
for (i=1; i<BarCount-1;i++)
{
if(Datex[i]!=Datex[i-1] )
{
Lastshort=0;priceatsell=priceatcover=priceatshort=0;Lastcover=0;Lastsell=newbuy=newshort=0;
}
if (Sell1[i])
{
Lastshort=1;
Lastbuy=0;
Lastsell=0;
starti=i;
priceatshort=H[i];
}
if(Buy1[i])
{
Lastbuy=1;
Lastshort=0;
Lastcover=0;
starti=i;
priceatbuy=L[i];
}
if (spsignals=="YES")
{
if (newshort==1 AND avp[i]<priceatcover-n4 AND O[i]>C[i])
{
sell1[i]=1;
newshort=0;
}
}
if(Buy1[i])
{
Lastbuy=1;
Lastshort=0;
Lastcover=0;
starti=i;
priceatbuy=L[i];
}
if (spsignals=="YES")
{
if (newshort==1 AND avp[i]<priceatcover-n4 AND O[i]>C[i])
{
sell1[i]=1;
newshort=0;
}
}
if (C[i]-sllow[i]>gapy AND Lastshort==1 AND Lastcover==0 AND I>starti AND sllow[i]==sllow[i-1])
{
Cover2[i]=1;
Lastcover=1;
priceatcover=C[i];
newshort=1;
}
if ((Lastcover==1 AND C[i]<priceatcover-(gapy/2)) )Lastcover=0;
if (spsignals=="YES")
{
if (newbuy==1 AND avp[i]>priceatsell+n4 AND O[i]<C[i])
{
Buy1[i]=1;
newbuy=0;
}
}
if ((Lastcover==1 AND C[i]<priceatcover-(gapy/2)) )Lastcover=0;
if (spsignals=="YES")
{
if (newbuy==1 AND avp[i]>priceatsell+n4 AND O[i]<C[i])
{
Buy1[i]=1;
newbuy=0;
}
}
if(slhigh[i]-C[i]>gapy AND Lastbuy==1 AND Lastsell==0 AND i>starti AND slhigh[i]==slhigh[i-1])
{
Sell2[i]=1;
Lastsell=1;
// priceatsell=avp[i];
priceatsell=C[i];
}
if ((Lastsell==1 AND C[i]>priceatsell+(gapy/2)) )Lastsell=0;
Sell2[i]=1;
Lastsell=1;
// priceatsell=avp[i];
priceatsell=C[i];
}
if ((Lastsell==1 AND C[i]>priceatsell+(gapy/2)) )Lastsell=0;
}
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
shape1 = Buy1 * shapeUpTriangle + Sell1 * shapeDownTriangle;
shape2 = Cover2 * shapeHollowUpArrow+ Sell2*shapeHollowDownArrow;
if(showsig=="YES")
{
PlotShapes( shape, IIf( Buy, colorBlue, colorRed ),0, IIf( Buy, Low, High ) );
PlotShapes( shape1, IIf( Buy1, colorBlue, colorRed ),0, IIf( Buy1, Low, High ) );
PlotShapes( shape2, IIf( Cover2, colorGreen, colorGreen ),0, IIf( Cover2, Low, High ) );
}
GraphXSpace = 5;
dist = 5*ATR(10);
mth=int(DateNum()/100)-int(DateNum()/10000)*100;
Currmthstart=int(DateNum()/100)*100;
shape1 = Buy1 * shapeUpTriangle + Sell1 * shapeDownTriangle;
shape2 = Cover2 * shapeHollowUpArrow+ Sell2*shapeHollowDownArrow;
if(showsig=="YES")
{
PlotShapes( shape, IIf( Buy, colorBlue, colorRed ),0, IIf( Buy, Low, High ) );
PlotShapes( shape1, IIf( Buy1, colorBlue, colorRed ),0, IIf( Buy1, Low, High ) );
PlotShapes( shape2, IIf( Cover2, colorGreen, colorGreen ),0, IIf( Cover2, Low, High ) );
}
GraphXSpace = 5;
dist = 5*ATR(10);
mth=int(DateNum()/100)-int(DateNum()/10000)*100;
Currmthstart=int(DateNum()/100)*100;
Profit=profitmth=0;
Lastsig=Lastbuysig=Lastsellsig=Lastcoversig=Lastshortsig=0;
for( i = 0; i < BarCount; i++ )
{
if (i>0)
{
if(mth[i]!=mth[i-1])
{
profitmth[i]=0;
}
else
{
profitmth[i]=profitmth[i-1];
}
Lastsig=Lastbuysig=Lastsellsig=Lastcoversig=Lastshortsig=0;
for( i = 0; i < BarCount; i++ )
{
if (i>0)
{
if(mth[i]!=mth[i-1])
{
profitmth[i]=0;
}
else
{
profitmth[i]=profitmth[i-1];
}
}
if(i>0)profit[i]=profit[i-1];
if((i>0 AND Datex[i]!= Datex[i-1]) OR i==(BarCount-1))
{
if(i!=BarCount-1)
{
if (Lastbuysig==1)profit[i]=profit[i]+avp[i-1]-priceatbuy;
if (Lastshortsig==1)profit[i]=profit[i]+priceatshort-avp[i-1];
}
else
{
if (Lastbuysig==1)profit[i]=profit[i]+avp[i]-priceatbuy;
if (Lastshortsig==1)profit[i]=profit[i]+priceatshort-avp[i];
}
if((i>0 AND Datex[i]!= Datex[i-1]) OR i==(BarCount-1))
{
if(i!=BarCount-1)
{
if (Lastbuysig==1)profit[i]=profit[i]+avp[i-1]-priceatbuy;
if (Lastshortsig==1)profit[i]=profit[i]+priceatshort-avp[i-1];
}
else
{
if (Lastbuysig==1)profit[i]=profit[i]+avp[i]-priceatbuy;
if (Lastshortsig==1)profit[i]=profit[i]+priceatshort-avp[i];
}
if (showprice=="YES" AND Interval()< 86400)PlotText( "Profit\n" + WriteVal(Profit[ i ],1.0) , i, L[ i ]-dist[i]/2, colorBlack );
if(Datex[i]>Currmthstart[i] AND mth[i]==mth[i-1] )
{
ProfitMth[i]=profitmth[i-1]+profit[i];
}
if(Datex[i]>Currmthstart[i] AND mth[i]==mth[i-1] )
{
ProfitMth[i]=profitmth[i-1]+profit[i];
}
profit[i]=0;
Lastsig=Lastbuysig=Lastsellsig=Lastcoversig=Lastshortsig=0;
}
if (Buy1[i])
{
Lastbuysig=1;
priceatbuy=avp[i];
if (Lastshortsig==1)
{
profit[i]=profit[i]+priceatshort-avp[i];
Lastshortsig=0;
}
}
if (Sell1[i])
{
Lastshortsig=1;
priceatshort=avp[i];
if (Lastbuysig==1)
{
profit[i]=profit[i]+avp[i]-priceatbuy;
Lastbuysig=0;
}
}
if (Cover2[i])
{
Lastcoversig=1;
priceatcover=avp[i];
if (Lastshortsig==1)
{
profit[i]=profit[i]+priceatshort-avp[i];
Lastshortsig=0;
}
}
if (Sell2[i])
{
Lastsellsig=1;
priceatsell=avp[i];
if (Lastbuysig==1)
{
profit[i]=profit[i]+avp[i]-priceatbuy;
Lastbuysig=0;
}
}
{
Lastshortsig=1;
priceatshort=avp[i];
if (Lastbuysig==1)
{
profit[i]=profit[i]+avp[i]-priceatbuy;
Lastbuysig=0;
}
}
if (Cover2[i])
{
Lastcoversig=1;
priceatcover=avp[i];
if (Lastshortsig==1)
{
profit[i]=profit[i]+priceatshort-avp[i];
Lastshortsig=0;
}
}
if (Sell2[i])
{
Lastsellsig=1;
priceatsell=avp[i];
if (Lastbuysig==1)
{
profit[i]=profit[i]+avp[i]-priceatbuy;
Lastbuysig=0;
}
}
if(showprice=="YES" )
{
if( Buy[i] ) PlotText( "CBuy\n@" + avp[ i ] , i, L[ i ]-dist[i], colorBlue );
if( Sell[i] ) PlotText( "CSell\n@" + avp[ i ], i, H[ i ]+dist[i], colorBlue);
if( Buy1[i] ) PlotText( "EBuy\n@" + avp[ i ], i, L[ i ]-dist[i], colorBlue );
if( Sell1[i] ) PlotText( "ESell\n@" + avp[ i ], i, H[ i ]+dist[i], colorBlue);
}
}
Plot( 1, "", IIf(EMA(C,15)>EMA(C,60) , colorPaleGreen, colorRose ),styleArea | styleOwnScale, 0, 1 );
_SECTION_END();
{
if( Buy[i] ) PlotText( "CBuy\n@" + avp[ i ] , i, L[ i ]-dist[i], colorBlue );
if( Sell[i] ) PlotText( "CSell\n@" + avp[ i ], i, H[ i ]+dist[i], colorBlue);
if( Buy1[i] ) PlotText( "EBuy\n@" + avp[ i ], i, L[ i ]-dist[i], colorBlue );
if( Sell1[i] ) PlotText( "ESell\n@" + avp[ i ], i, H[ i ]+dist[i], colorBlue);
}
}
Plot( 1, "", IIf(EMA(C,15)>EMA(C,60) , colorPaleGreen, colorRose ),styleArea | styleOwnScale, 0, 1 );
_SECTION_END();
_SECTION_BEGIN("Volume At Price");
//PlotVAPOverlay(Param("Lines", 1000, 100, 1000, 10), Param("Width", 15, 1, 100, 1), ParamColor("Color", colorBlue), ParamToggle("Side", "Left|Right", 1) | 4 *ParamToggle("Z-order", "On top|Behind", 1));
_SECTION_END();
Title = "Moving Average TRADES "+Date()+" "+ Interval(format=2)+" "+Name()+" "+"O "+WriteVal(O,1.2)+" "+"H "+WriteVal(H,1.2)+" L"+WriteVal(L,1.2)+" C "+WriteVal(C,1.2)+" Vol "+WriteVal(V,1.0)+" "+EncodeColor(colorRed)+WriteIf(EMA(C,3)>EMA(C,16),EncodeColor(colorGreen),EncodeColor(colorRed))+" EMA 3/16 "+WriteVal(EMA(C,3),1.0)+"/"+WriteVal(EMA(C,16),1.0)+WriteIf(EMA(C,15)>EMA(C,60),EncodeColor(colorGreen),EncodeColor(colorRed))+" EMA 15/60 "+WriteVal(EMA(C,15),1.0)+"/"+WriteVal(EMA(C,60),1.0)+" ProfitMth "+WriteVal(profitmth+profit,1.0)+" Bar Secs Left "+ WriteVal(secstogo,1.0)+" "+
"\n"+EncodeColor(colorRed)+" Stoploss " +WriteVal(Trailstop,1.2)
;
Title = "Moving Average TRADES "+Date()+" "+ Interval(format=2)+" "+Name()+" "+"O "+WriteVal(O,1.2)+" "+"H "+WriteVal(H,1.2)+" L"+WriteVal(L,1.2)+" C "+WriteVal(C,1.2)+" Vol "+WriteVal(V,1.0)+" "+EncodeColor(colorRed)+WriteIf(EMA(C,3)>EMA(C,16),EncodeColor(colorGreen),EncodeColor(colorRed))+" EMA 3/16 "+WriteVal(EMA(C,3),1.0)+"/"+WriteVal(EMA(C,16),1.0)+WriteIf(EMA(C,15)>EMA(C,60),EncodeColor(colorGreen),EncodeColor(colorRed))+" EMA 15/60 "+WriteVal(EMA(C,15),1.0)+"/"+WriteVal(EMA(C,60),1.0)+" ProfitMth "+WriteVal(profitmth+profit,1.0)+" Bar Secs Left "+ WriteVal(secstogo,1.0)+" "+
"\n"+EncodeColor(colorRed)+" Stoploss " +WriteVal(Trailstop,1.2)
;
0 nhận xét: