I have two pairs of tickers, XYZ1 and XYZ2, and ZYZ1 and ZYX2. I would like the system NOT to take a new long position in some cross pairs; specifically, no new long position in ZYX1 when there is an open long in XYZ1, and vice versa, and NOT a new long position in ZYX2 when there is an open position in YXZ2, and vice versa. I tried this with flip(buy, sell) for each symbol as follows:
if ( Name () == "XYZ1" ) {
//system code
intradeXYZ1=flip(buy, sell);
buy=iif(intradeZXY1,0,1);
}
if ( Name () == "XYZ2" ) {
//system code
intradeXYZ2=flip(buy, sell);
buy=iif(intradeZXY2,0,1);
}
if ( Name () == "ZYX1" ) {
//system code
intradeZYX1=flip(buy, sell);
buy=iif(intradeXYZ1,0,1);
}
if ( Name () == "ZYX2" ) {
//system code
intradeXYZ2=flip(buy, sell);
buy=iif(intradeXYZ1,0,1);
}
I get the impression this is spaghetti code I wrote, and it does not work, by the way. Any suggestions? Thanks.