Problem with “Trading the strategy profit curve”
Forums › ProRealTime English forum › ProOrder support › Problem with “Trading the strategy profit curve”
- This topic has 20 replies, 3 voices, and was last updated 4 years ago by
Link.
-
-
05/02/2021 at 10:45 AM #168558
I am trying to adapt this Nicolas Money management system to my strategy.
The problem is that I can’t get that when the strategy profit falls below the equity curve the system stops operating.
So far what I have is this:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849//variablesequitycurve = undefinedcurveperiod = 17280once mydays = 1once olddate = 0//indicatorsequitycurve = average[curveperiod](strategyprofit)//mydays variable incrementing to let the average curve build over timeif date > olddate thenmydays=mydays+1olddate = dateendif//first trades while the average profit curve is buildingIF CONDBUY and Strategyprofit <= 20000 and NOT LongOnMarket AND mydays<curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ELSE//trades when the curve has builtIF CONDBUY and Strategyprofit <= 20000 and NOT LongOnMarket AND strategyprofit>=equitycurve AND mydays>curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ENDIFENDIF//first trades while the average profit curve is buildingIF CONDBUY and Strategyprofit >= 20000 and NOT LongOnMarket AND mydays<curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ELSE//trades when the curve has builtIF CONDBUY and Strategyprofit >= 20000 and NOT LongOnMarket AND strategyprofit>=equitycurve AND mydays>curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ENDIFENDIFGRAPH equitycurve coloured(255,0,0) as "equity curve"GRAPH strategyprofit as "strategy profit"05/02/2021 at 10:51 AM #16856005/02/2021 at 11:10 AM #16856105/02/2021 at 11:14 AM #168562This is the link of Nicolás strategy.
https://www.prorealcode.com/blog/trading-strategy-profit-curve/
1 user thanked author for this post.
05/02/2021 at 11:22 AM #16856305/02/2021 at 11:44 AM #16856405/02/2021 at 11:45 AM #168565Lines 48-50 do the job:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//variablesONCE equitycurve = 0curveperiod = 17280once mydays = 1once olddate = 0//indicatorsequitycurve = average[curveperiod](strategyprofit)//mydays variable incrementing to let the average curve build over timeif date > olddate thenmydays=mydays+1olddate = dateendifCONDBUY = close crosses over average[200,0](close)//first trades while the average profit curve is buildingIF CONDBUY and Strategyprofit <= 20000 and NOT LongOnMarket AND mydays<curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ELSE//trades when the curve has builtIF CONDBUY and Strategyprofit <= 20000 and NOT LongOnMarket AND strategyprofit>=equitycurve AND mydays>curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ENDIFENDIF//first trades while the average profit curve is buildingIF CONDBUY and Strategyprofit >= 20000 and NOT LongOnMarket AND mydays<curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ELSE//trades when the curve has builtIF CONDBUY and Strategyprofit >= 20000 and NOT LongOnMarket AND strategyprofit>=equitycurve AND mydays>curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ENDIFENDIFIF StrategyProfit CROSSES UNDER equitycurve THENQUITENDIFGRAPH equitycurve coloured(255,0,0) as "equity curve"GRAPH strategyprofit as "strategy profit"05/02/2021 at 12:00 PM #16856605/02/2021 at 12:12 PM #168567You wrote “system stops operating“. Indeed pausing it makes no sense, since it’s almost like QUIT if you don’t add any condition to resume operations, but… there you go:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354//variablesONCE equitycurve = 0curveperiod = 17280once mydays = 1once olddate = 0//indicatorsequitycurve = average[curveperiod](strategyprofit)ONCE TradeON = 1IF StrategyProfit CROSSES UNDER equitycurve THENTradeON = 0ENDIF//mydays variable incrementing to let the average curve build over timeif date > olddate thenmydays=mydays+1olddate = dateendifCONDBUY = close crosses over average[200,0](close) AND TradeON//first trades while the average profit curve is buildingIF CONDBUY and Strategyprofit <= 20000 and NOT LongOnMarket AND mydays<curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ELSE//trades when the curve has builtIF CONDBUY and Strategyprofit <= 20000 and NOT LongOnMarket AND strategyprofit>=equitycurve AND mydays>curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ENDIFENDIF//first trades while the average profit curve is buildingIF CONDBUY and Strategyprofit >= 20000 and NOT LongOnMarket AND mydays<curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ELSE//trades when the curve has builtIF CONDBUY and Strategyprofit >= 20000 and NOT LongOnMarket AND strategyprofit>=equitycurve AND mydays>curveperiod THENONCE Positionsize = 0.5buy positionsize contract at marketSET TARGET %PROFIT 2SET STOP %LOSS 1.5ENDIFENDIFGRAPH equitycurve coloured(255,0,0) as "equity curve"GRAPH strategyprofit as "strategy profit"I added lines 10-13, then added TradeON to CONDBUY at line 19.
05/02/2021 at 12:15 PM #16856805/02/2021 at 1:02 PM #16857005/02/2021 at 1:08 PM #168572How can the curve go up again if trading is paused?
Try adding this AFTER line 13:
123IF StrategyProfit CROSSES OVER equitycurve THENTradeON = 1ENDIF05/02/2021 at 1:17 PM #16857305/02/2021 at 1:46 PM #16857405/02/2021 at 2:00 PM #168577 -
AuthorPosts
Find exclusive trading pro-tools on