Hello,
Can a StopProfit be set only for Shorts? I would like Short trades to exit when they reach 5% Profit.
How could I add that to this AFL? I have added an ApplyStop line but it does not work for what I want.
Thanks you very much
_SECTION_BEGIN("Sistema cruce WMA30 Semanal");
// 1. TIPO DE SISTEMA [SIEMPRE]
SetBacktestMode( backtestRegular );
// 5. BACKTESTER SETTINGS [SIEMPRE]
SetOption( "InitialEquity", 30000 );
SetTradeDelays(0,0,0,0);
SetOption("CommissionMode", 2);
SetOption( "CommissionAmount", 1 );
BuyPrice = SellPrice = ShortPrice = CoverPrice = Close;
// 8. TAMAÑO DE LA POSICIÓN [SIEMPRE]
SetPositionSize( 100, spsPercentOfEquity);
// 9. CÁLCULO INDICADORES [SIEMPRE]
SPX=Foreign("$SPX","C");
MediaPonderada = WMA(SPX,30);
// 10. REGLAS DEL SISTEMA [SIEMPRE]
CruceAlcista = Cross(SPX,MediaPonderada);
CruceBajista = Cross(MediaPonderada, SPX);
Buy = Cover = CruceAlcista;
Sell = Short = CruceBajista;
// 11. STOPLOSS [OPCIONAL]
// Nada
// 12. TAKEPROFIT [OPCIONAL]
ApplyStop (stopTypeProfit,stopModePercent,5,ExitAtStop =1);
// 13. ELIMINAR SEÑALES EXTRAS [OPCIONAL]
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
_SECTION_END();