Risk Management code + ATR stop loss
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Risk Management code + ATR stop loss
Tagged: atr, money management, risk, Risk Management, stop loss, stoploss
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
// Conditions to enter long positions indicator1 = 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 THEN BUY 100 PERPOINT AT MARKET ENDIF // Conditions to exit long positions indicator4 = MACDline[12,26,9](close) indicator5 = ExponentialAverage[9](indicator4) c3 = (indicator4[1] CROSSES UNDER indicator5[1]) IF c3 THEN SELL AT MARKET ENDIF // Conditions to enter short positions indicator6 = 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 THEN SELLSHORT 100 PERPOINT AT MARKET ENDIF // Conditions to exit short positions indicator9 = MACDline[12,26,9](close) indicator10 = ExponentialAverage[9](indicator9) c6 = (indicator9[1] CROSSES OVER indicator10[1]) IF c6 THEN EXITSHORT AT MARKET ENDIF // Stops and targets SET STOP pLOSS 50 SET TARGET pPROFIT 200 |
To write code, please use the <> “insert PRT code” button, to make code easier to understand. Thank you.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
/ Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated // Conditions to enter long positions indicator1 = 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 THEN BUY 100 PERPOINT AT MARKET ENDIF // Conditions to exit long positions indicator4 = MACDline[12,26,9](close) indicator5 = ExponentialAverage[9](indicator4) c3 = (indicator4[1] CROSSES UNDER indicator5[1]) IF c3 THEN SELL AT MARKET ENDIF // Conditions to enter short positions indicator6 = 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 THEN SELLSHORT 100 PERPOINT AT MARKET ENDIF // Conditions to exit short positions indicator9 = MACDline[12,26,9](close) indicator10 = ExponentialAverage[9](indicator9) c6 = (indicator9[1] CROSSES OVER indicator10[1]) IF c6 THEN EXITSHORT AT MARKET ENDIF // Stops and targets SET STOP pLOSS 50 SET TARGET pPROFIT 200 |
Hi – 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
Find exclusive trading pro-tools on