modification in afl needed

lvgandhi

Well-Known Member
#1
In the following afl, I need a few modifications.

_SECTION_BEGIN("Stochastic_30_MINS");
periods = Param( "Periods", 8, 1, 30, 1 );
Ksmooth = Param( "%K avg", 3, 1, 10, 1 );
Dsmooth = Param( "%D avg", 4, 1, 10, 1 );
barInterval = Interval();

TimeFrameSet(barInterval * 5);
k30 = StochK( periods , Ksmooth);
d30 = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();

K = TimeFrameExpand(k30, barInterval * 5);
D = TimeFrameExpand(d30, barInterval * 5);

Hi = IIf(k > d, k, d);
Lo = IIf(k < d, k, d);

_SECTION_END();

_SECTION_BEGIN("Stochastic %D");
periods1 = Param( "Periods1", 8, 1, 200, 1 );
Ksmooth1 = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth1 = Param( "%D avg", 4, 1, 200, 1 );
U = StochK( periods1 , Ksmooth1);
T = StochD( periods1 , Ksmooth1, DSmooth1 );

_SECTION_END();

_SECTION_BEGIN("ema5,13sound");
GraphXSpace =10;

fmap = Optimize("FMAP",5,2,20,1);
smap = Optimize("SMAP",13,3,48,5);

x = EMA(Close,fmap);
y = EMA(Close,smap);
Plot(EMA(Close,fmap),"",colorBrightGreen,styleLine);
Plot(EMA(Close,smap),"",colorRed,styleLine);
//XR=(EMA(Close,fmap) * (2 / 6 - 1) - EMA(Close,smap) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorYellow ) +"THE PRIDE system, (BUY-SELL GREEN ARROW-GREEN CIRCLE), (SHORT-COVER RED ARROW-RED CIRCLE)- When fast Stochastic reverses from it's upward move, curves downwards AND crosses the slow line from above, Sell half of the units. if the next bar goes below the Low of the previous bar, exit completely, otherwise keep a tight trailing stoploss AND enjoy the continuing bull market" +EncodeColor( colorRed )+ " - O " + O + " H " + H + " L " + L + " C "+ C + "\n";
Plot(C,"SIMPLE TRADING SYSTEM",IIf(C>Ref(C,-1),colorLime,colorOrange),styleCandle);
Buy=(((K > D) OR (K<D AND D<25))AND (U > T) AND (U< 75) AND (x>=y));
Sell=Cross(T,U) OR (T>=U);
Short=(((D > K) OR (K>D AND D>75) )AND (T > U) AND (T > 25 ) AND (y>=x));
Cover=Cross(U,T) OR (T<=U);
Buy=ExRem(Buy,Sell);
Sell= ExRem(Sell,Buy);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorBrightGreen, 0,L, Offset=-5);
PlotShapes(IIf(Sell, shapeHollowSmallCircle, shapeNone),colorOrange, 0,H, Offset=15);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-5);
PlotShapes(IIf(Cover, shapeHollowSmallCircle, shapeNone),colorPaleGreen, 0,L, Offset=-15);
_SECTION_END();

1)I want to sell only half at present sell and another half only if the low of the present sell bar is broken by a filter of say atr14*.25. Similar for cover

2)Instead of sell and cover, I want to use those conditions as trigger.
For example I want present sell as sell trigger candle and if lower low occurs than trigger then sell should occur. Trigger low should be valid until another sell trigger occurs.

3) at 15:20 all position should be liquidated and fresh positions only next day

any modifications, help please.
 
Last edited:

Similar threads