Help to convert this strategy in AFL

#1
Hi,

Can any expert here write a AFL for the strategy given below. This is particularly useful in rangebound markets:

Settings: two panes in amobroker, above showing price with pivot levels, second below showing stochatistics.

Buy - When stochastic %K crosses %D when %K is below 30% (or between 20-30%), we Buy at nearest Support or on Breakout above Nearest Resistance level.

Sell - When Stochastic %K Crosses % D when %K is above 75% (or between 75-85%), we sell at the nearest resistance point or sell on break of nearest support.

Thanks,

Rythm....
 
#2
4u:


periods = Param( "Periods", 14, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
myStochD =StochD( periods , Ksmooth, DSmooth );
myStochK =StochK( periods , Ksmooth);
Overbought = 75 ;
Oversold =30 ;


Buy = Cross(myStochK, myStochD ) and myStochK<Oversold ;

Sell = Cross(myStochD, myStochK ) and myStochK>Overbought ;


modify as your needed
 
#3
Hi baby.learn.to.trade,

Thanks for your response. Please see below how the logic should follow in the code to automate the system:

Buy:

1. %K crosses %D below 30 in pane 2
2. Now, till the time %D remains below 75% in pane 2, (use while function?), code in pane 1 checks if price comes near (we can use filter of 0.1%) nearest support OR breaks above nearest resistance (filter of 0.1%).
3. Buy/ Sell can be depicted with arrows or we can use WriteIf function to display Buy at or Buy above on top of pane.
4. Vice-versa for Sell Call

I am trying to write the code myself. If successful, will share it here. Till that time, if you can also help in same, it will be highly appreciated.

Note: This code will require one code checking the values from the other code in a different pane.

Thanks,

Rythm...
 

Similar threads