Forums › ProRealTime English forum › General trading discussions › Stop loss % of capital › Reply To: Stop loss % of capital
07/24/2018 at 5:37 AM
#76563
I tried this but it didnt work.
I did find this however but cannot alter it to my conditions. Any thoughts? Stoploss and stoplevel confuse me??
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 |
REM Money Management Capital = 3000 // initial capital at launch of the strategy Risk = 3 // risk in percent REM Calculate contracts equity = Capital + StrategyProfit maxrisk = round(equity*(Risk/100)) REM defining moving averages EMA5 = exponentialaverage[25] EMA100 = exponentialaverage[100] EMA200 = exponentialaverage[600] hh = highest[10](high) ll = lowest[10](low) // -- case BUY if EMA5 crosses over EMA200 then stoploss = (close-ll[1])/pointsize stoplevel = (close-ll[1]) PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize) BUY PositionSize SHARES AT MARKET endif // -- case SELL if EMA5 crosses under EMA200 then stoploss = (hh[1]-close)/pointsize stoplevel = (hh[1]-close) PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize) SELLSHORT PositionSize SHARES AT MARKET endif // -- trades exit if EMA5 crosses under EMA100 then SELL AT MARKET endif if EMA5 crosses over EMA100 then EXITSHORT AT MARKET endif SET STOP LOSS stoplevel |