I decided to adjust my system to a 2:1 and no trail is now required.
Chris
I would like to thank everyone that contributed to my post. I really do appreciate your knowledge.
Chris
hi guys ,
pleae could somebody explain me why this break even i not working . The strategy don´t consider it ? I expect a Kept in profit of 5 point but d0n´t work. thanks in advance
//-------------------------------------------------------------------------
// Hauptcode : SAR Kauf TOP mit BREAKEVEN 5mi
//-------------------------------------------------------------------------
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = SAR[0.02,0.02,0.2]
c1 = (indicator1 CROSSES over close)
startBreakeven = 1 //how much pips/points in gain to activate the breakeven function?
PointsToKeep = 5 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
//SET STOP PLOSS 10 //first stoploss
//reset the breakevenLevel when no trade are on market
IF NOT ONMARKET THEN
breakevenLevel=0
ENDIF
// --- BUY SIDE ---
//test if the price have moved favourably of "startBreakeven" points already
IF SHORTONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
SELL AT breakevenLevel STOP
ENDIF
IF c1 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Bedingungen zum Ausstieg von Long-Positionen
indicator2 = RSI[14](close)
c2 = (indicator2 CROSSES over 30)
indicator3 = RSI[14](close)
c3 = (indicator3[1] < indicator3)
IF c2 AND c3 THEN
exitshort at market
endif
You are going short, you should replace line 27 with
IF SHORTONMARKET AND (tradeprice(1)-close)>=(startBreakeven*pipsize) THEN
and line 29 with
breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
many thanks but i am not convinced that it works . Have you got backtest it ? In my backtests i couldn´t find stops in order (points to keep ) maybe it works not in going short .
I backtested it on DAX, 5-minute TF, calculations are fine.
Keep in mind that 1 pips is way too low, I guess, and orders in real accounts could be rejected because too close to price.
Moreover, I just realized you are using SELL to exit a short trade, while you should use EXITSHORT (SELL is reserved to exit a LONG position).
i understand thanks for help