Stop loss % of capital

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #75043 quote
    ChrisNYE
    Participant
    Senior

    How would I code a stop loss based on my current capital amount? As my capital goes up my 1% stop loss should also increase in value and vice versa. So I want to risk 1% constantly depending on my capital balance

    #75054 quote
    Vonasi
    Moderator
    Master

    I see you are still messing around with money management when your efforts would be better used on getting a basic strategy up and running on level stakes! 🙂

    I do not understand why you would want to do what you are requesting. The markets do not know or care how much capital you have so basing your stop loss level on this is of no benefit at all. Your variable level stop loss should be based on how the markets are moving currently. Volatility would be a better measure to use than cash in the bank!

    #75063 quote
    TempusFugit
    Participant
    Veteran

    I haven´t tested but I think something like this should work:

    CAPITAL = 1000 //Your initial capital
    
    IF POSITIONPERF < -0.01*(CAPITAL+STRATEGYPROFIT) THEN
    SELL AT MARKET
    EXITSHORT AT MARKET
    ENDIF

    I tend to agree with Vonasi, the stops probably are better related to the position itself not the overall performance

    But as I heard recently from someone (not remember who): “The moneymanagement doesn´t have any importance, until it means everything”

    Nicolas thanked this post
    #76563 quote
    ChrisNYE
    Participant
    Senior

    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??

    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
    
    #76565 quote
    GraHal
    Participant
    Master

    Any thoughts? Stoploss and stoplevel confuse me??

    Re below … for a market where pointsize / pipsize = 1 (DAX for example) then stoploss and stoplevel would be the same, but for a market where pointsise / pipsize = something other than 1 (0.0001 for EUR/USD for example) then  stoploss and stoplevel are NOT the same.

    stoploss = (hh[1]-close)/pointsize
    stoplevel = (hh[1]-close)

     

    Anyway I’ve never ever used the term stoplevel … isn’t it just that the code Author has used that term stoplevel in that code / strategy and they could have used myStop / whatever and it be a lot less less confusing?? 🙂

    Same goes for stoploss, don’t confuse stoploss with Set Stop Loss … two different things. I would have used myStop1 for stoploss and mystop2 for stoplevel in the code in your post above. Reason: enough things confuse me so I would not want to add more confusion! 🙂

    I stand to be corrected on my assertions above … maybe I am confusing myself? 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Stop loss % of capital


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
ChrisNYE @chrisnye Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by GraHal
7 years, 7 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 07/02/2018
Status: Active
Attachments: No files
Logo Logo
Loading...