Risk Management code + ATR stop loss
Forums › ProRealTime English forum › ProOrder support › Risk Management code + ATR stop loss
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by razalgo.
Tagged: atr, money management, risk, Risk Management, stop loss, stoploss
-
-
09/18/2018 at 10:13 PM #80825
Guys
Very new to all this but managed to come up with the below algo.
Can anyone advise how do i change the below code so it does the following points
Risk Management – Auto calculates £ per point based upon 10% risk to my capital account. e.g £10,000 capital would risk £1000.
stop loss = 1* ATR
take profit = 5* ATR
so if ATR is 10, the £ per point would be £100 (stop loss = 1* 10*£100 = £1000) which is my risk management strategy.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485// Conditions to enter long positionsindicator1 = Average[90](close)c1 = (close[1] > indicator1[1])indicator2 = MACDline[12,26,9](close)indicator3 = ExponentialAverage[9](indicator2)c2 = (indicator2[1] CROSSES OVER indicator3[1])IF c1 AND c2 THENBUY 100 PERPOINT AT MARKETENDIF// Conditions to exit long positionsindicator4 = MACDline[12,26,9](close)indicator5 = ExponentialAverage[9](indicator4)c3 = (indicator4[1] CROSSES UNDER indicator5[1])IF c3 THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator6 = Average[90](close)c4 = (close[1] < indicator6[1])indicator7 = MACDline[12,26,9](close)indicator8 = ExponentialAverage[9](indicator7)c5 = (indicator7[1] CROSSES UNDER indicator8[1])IF c4 AND c5 THENSELLSHORT 100 PERPOINT AT MARKETENDIF// Conditions to exit short positionsindicator9 = MACDline[12,26,9](close)indicator10 = ExponentialAverage[9](indicator9)c6 = (indicator9[1] CROSSES OVER indicator10[1])IF c6 THENEXITSHORT AT MARKETENDIF// Stops and targetsSET STOP pLOSS 50SET TARGET pPROFIT 20009/18/2018 at 10:42 PM #80826To write code, please use the <> “insert PRT code” button, to make code easier to understand. Thank you.
09/20/2018 at 9:24 PM #80993My first Algo12345678910111213141516171819202122232425262728293031323334353637383940414243444546/ Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsindicator1 = Average[90](close)c1 = (close[1] > indicator1[1])indicator2 = MACDline[12,26,9](close)indicator3 = ExponentialAverage[9](indicator2)c2 = (indicator2[1] CROSSES OVER indicator3[1])IF c1 AND c2 THENBUY 100 PERPOINT AT MARKETENDIF// Conditions to exit long positionsindicator4 = MACDline[12,26,9](close)indicator5 = ExponentialAverage[9](indicator4)c3 = (indicator4[1] CROSSES UNDER indicator5[1])IF c3 THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator6 = Average[90](close)c4 = (close[1] < indicator6[1])indicator7 = MACDline[12,26,9](close)indicator8 = ExponentialAverage[9](indicator7)c5 = (indicator7[1] CROSSES UNDER indicator8[1])IF c4 AND c5 THENSELLSHORT 100 PERPOINT AT MARKETENDIF// Conditions to exit short positionsindicator9 = MACDline[12,26,9](close)indicator10 = ExponentialAverage[9](indicator9)c6 = (indicator9[1] CROSSES OVER indicator10[1])IF c6 THENEXITSHORT AT MARKETENDIF// Stops and targetsSET STOP pLOSS 50SET TARGET pPROFIT 20009/20/2018 at 9:27 PM #80994Hi – I used the <>”insert PRT button” – thanks for advising that. much appreciated
What needs to change so it automatically calculates the £ per point based upon my risk management strategy (10% risk loss of capital per trade) and max loss is 1* ATR and take profit at 5*ATR
-
AuthorPosts
Find exclusive trading pro-tools on