no one wants to make an effort ... wow!!!

#1
can some one help me to make this code correctly please. i want to add a stop loss if the stock fell more than $0.20 and sell after 0.20 profil and i want to close the trade the end of the day even i didn't reached my objectif, thankyou.

myClose1 = ValueWhen(DayOfWeek() == 4, Close);
myClose2 = ValueWhen (DayOfWeek() == 3, Close) ;
//myClose3 = myClose1 > myClose2 ;
Cond1 = myClose1 > myClose2 ;
Cond2 = DayOfWeek()==2;
Cond3 = Open > Ref(Close,-1) + 0.10;

Buy = Cond1 AND Cond2 AND Cond3 ;
 

Rajvir

Active Member
#2
Try adding this in the AFL

BarsToday = 1 + BarsSince( Day() != Ref(Day(), -1));

StartBar = ValueWhen(TimeNum() == 091500, BarIndex()); // edit the 091500 to mkt time opening if you trading any other mkt

Condition1= ValueWhen(Buy,C,1);
Sell= (H-Condition1>.20 AND H>Condition1) OR (condition1-L>.20 AND
Condition1>L) or timeNum()>152500; // edit 152500 to closing time of mkt if not trading NSE
 

Similar threads