Max weekly loss ?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #68996 quote
    Berra
    Participant
    Veteran

    Hi
    I would like to limited the weekly loss in a strategy. The strategy start on Monday and stop that week if “Max Weekly Loss” occurs and after that start on Monday again.
    Have try with this code but I don’t know if it is correct.

    ONCE TradeAllowedWeek = 1
    MaxWeeklyLoss  = 200
    
    IF IntradayBarIndex = 0 THEN
    TradeAllowedWeek = 1         
    ENDIF
    
    
    // -----
    IF opendayofweek =1 AND intradaybarindex=0 THEN    // Monday
    Result1 = MyProfitFRIDAY - STRATEGYPROFIT
    If Result1 <= -MaxWeeklyLoss THEN
    TradeAllowedWeek =0
    ENDIF
    ENDIF
    iF opendayofweek =2 AND intradaybarindex=0 THEN    // Tuesday
    Result2 = MyProfitFRIDAY - STRATEGYPROFIT
    If Result2 <= -MaxWeeklyLoss THEN
    TradeAllowedWeek =0
    endif
    ENDIF
    if opendayofweek =3 AND intradaybarindex=0 THEN    // Wednesday 
    Result3 = MyProfitFRIDAY - STRATEGYPROFIT
    If Result3 <= -MaxWeeklyLoss THEN
    TradeAllowedWeek =0
    endif
    ENDIF
    if opendayofweek =4 AND intradaybarindex=0 THEN    //Thursday
    Result4 = MyProfitFRIDAY - STRATEGYPROFIT
    If Result4 <= -MaxWeeklyLoss THEN
    TradeAllowedWeek =0
    endif
    ENDIF
    IF opendayofweek =5 AND intradaybarindex=0 THEN    //Friday
    MyProfitFRIDAY =  STRATEGYPROFIT
    ENDIF
    // -----
    
    if TradeAllowedWeek =1 and buyconditions then
    buy 1 lot at market
    endif
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Max weekly loss ?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Berra @berra Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/23/2018
Status: Active
Attachments: No files
Logo Logo
Loading...