I'm using script editor to create my strategy. I want to, for example, enter into a long position with a profit targe. To make sure the enter price can be captured, I hope to submit an exit order with a higher price first as the exit point, and then submit the enterlonglimit() order with current price. I'm not sure if it is possible to submit the two orders at the same time as shown below:
I tried the following two expressions but neither works. Do you know how to submit the enter and take profit order at the same time? Or I have to wait for the long position established? Thanks!
#1
if(GetCurrentAsk(0)==Close[0]&&Purchase_flag==1)
{
Purchase_flag=2;
EnterShortLimit(0,Close[0]+1,@"S1");
EnterLongLimit(0, Close[0], @"Long1");
Print("Purchase_flag0");
}
#2
if(GetCurrentAsk(0)==Close[0]&&Purchase_flag==1)
{
Purchase_flag=2;
ExitLongLimit(Close[0]+1,"");
EnterLongLimit(0, Close[0], @"Long1");
Print("Purchase_flag0");
}
Comment