Breakeven vs MFE
Forums › ProRealTime English forum › ProOrder support › Breakeven vs MFE
- This topic has 2 replies, 3 voices, and was last updated 2 years ago by PeterSt.
-
-
01/11/2022 at 1:56 AM #185051
Hello,
Testing this very simple system to understand how the breakeven works compared to MFE. Dow TF 5 min.
Simple for test1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586DEFPARAM CUMULATEORDERS = FALSETIMEFRAME(1 hour)MAFastH1 = HullAverage[5](close)MASlowH1 = HullAverage[13](close)TIMEFRAME(DEFAULT)MAFastM5 = HullAverage[8](close)MASlowM5 = HullAverage[21](close)StoK = Stochastic[8,3](close)StoD = Stochasticd[8,3,5](close)////////////long=0short=0if stok>50 and stok<stok[1] and stok<stod and MAFastM5<MASlowM5 and MAFastH1<MASlowH1 thenshort=-1endifif stok<50 and stok>stok[1] and stok>stod and MAFastM5>MASlowM5 and MAFastH1>MASlowH1 thenlong=+1endif// Conditions pour ouvrir une position acheteuseIF NOT LongOnMarket AND long=+1 THENBUY 1 CONTRACTS AT MARKETENDIF// Conditions pour fermer une position acheteuseIf LongOnMarket AND (short=-1 or (stok[1]<stok and stok[1]<stok[2])) THENSELL AT MARKETSELLSHORT 1 CONTRACTS AT MARKETENDIF// Conditions pour ouvrir une position en vente à découvertIF NOT ShortOnMarket AND short=-1 THENSELLSHORT 1 CONTRACTS AT MARKETENDIF// Conditions pour fermer une position en vente à découvertIF ShortOnMarket AND (long=+1 or (stok[1]>stok and stok[1]>stok[2])) THENEXITSHORT AT MARKETBUY 1 CONTRACTS AT MARKETENDIF// Stops et objectifs : entrez vos stops et vos objectifs iciSET STOP %LOSS 1///2 BREAKEAVEN///////////once breakeaven = 1//1 on - 0 offstartBreakeven = 35 //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)///2/////////////////////////////////////////////////reset the breakevenLevel when no trade are on marketif breakeaven>0 thenIF NOT ONMARKET THENbreakevenLevel=0ENDIF// --- BUY SIDE ---//test if the price have moved favourably of "startBreakeven" points alreadyIF LONGONMARKET AND close-tradeprice>=startBreakeven*pipsize THEN//calculate the breakevenLevelbreakevenLevel = tradeprice+PointsToKeep*pipsizeENDIF//plce the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENSELL AT breakevenLevel STOPENDIF// --- end of BUY SIDE ---IF SHORTONMARKET AND tradeprice-close>startBreakeven*pipsize THEN//calculate the breakevenLevelbreakevenLevel = tradeprice-PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENEXITSHORT AT breakevenLevel STOPENDIFendifGRAPHONPRICE breakevenLevel coloured(0,0,255,255)The breakeven is set to 35 (result of backtest). But on Jan. 3rd at 00:00 the system takes a short which shows an MFE of +101.20, so much higher than the breakeven, but the trade is closed at a loss of -1.5.
On the graph, when I looked at the entry price and the low of the candle, there were approx. 38 points. May be not enough to trigger the Breakeven given the Spread of 4.8. After this entry candle and until the exit, it was was a loss all the way (not possible to have a positive MFE). But how the MFE is +101 then?
Someone can please help me understand ?
Thanks
01/11/2022 at 4:59 AM #185055It might be because the breakeven uses Close ???
Try replacing it with High (line 65) and Low (line 76)
This usually gives a better result and would certainly explain why it didn’t trigger at 38 points.
Could be that the MFE is just wrong. I’ve often seen some incomprehensible numbers in that column.
1 user thanked author for this post.
01/11/2022 at 7:50 AM #185058Hello Khaled – I suppose that you can set the TimeFrame to 1 second for graphing the gain ? Thus only for that – then back to 1 hour. Then you can see the MFE yourself for this situation ?
1 user thanked author for this post.
-
AuthorPosts