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