I have decided to repost this project with a change in detail.
I want a review and possible additions to my amibroker code. I have posted the code below for review.
The code is defined for CFD trading on margin.
margin in 10 percent in this case.
Interest is paid on long open positions. x amount per day
Position size is percentage risk (2 %) * equity/ 2 * atr(100)
Buy Filter is fast moving average > slow moving average
Buy Filter is the moving average 10 of Rate of change (63) > moving average 25 of Rate of change (63)
Buy if todays close is higher or equal to the highest close in the past 50 days.
The opposite is applied to a sell position.
Close is trailing stop 3 * ATR(100). Note this is the same for short positions
SetPositionSize( 2, spsPercentOfEquity )/(2* ATR(100));
MAFAST = EMA( Close, 50 );
MASLOW = EMA( Close, 100 );
ROCma1 = MA (Close,10);
ROCma2 = MA (Close,25);
ROCmaF = ROC( ROCma1, 63 ) ;
ROCmaS = ROC( ROCma2, 63 ) ;
HighestValue = HHV(C,50);
LowestValue = LLV(C,50);
Buy = C >= HighestValue AND MAFAST > MASLOW AND ROCmaF > ROCmaS ;
Short = C stop[ i - 1] )
temp = Close[ i ] - myATR[ i ];
if ( temp > stop[ i - 1 ] )
stop[ i ] = temp;
stop[ i ] = stop[ i - 1 ];
stop[ i ] = initial[ i ];
Plot( stop, "ATR Stop", colorRed, styleLine );
Sell = C < Ref( stop, -1 );
Buy = ExRem (Buy, Sell);
Sell = ExRem (Sell, Buy );
PlotShapes( IIf( stop < Ref( stop, -1 ), shapeDownArrow, Null ), colorOrange, 0, H );
Plot(HighestValue, "High", colorGreen, styleLine, 0,0,0,0);