code question, it's probably simple...

 

i'm trying to write a code that will open 6 trades, 3 buys, and 3 sells.


I have a script set to place orders with a Ask/Bid-15, 20, and 25 stop loss, but i want to add a trailing stop with the same values as the stop loss. How do i do this?


here's the script -


int start()
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-15*Point,0,"JMBUYER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-20*Point,0,"JMBUYER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-25*Point,0,"JMBUYER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+15*Point,0,"JMSELLER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+20*Point,0,"JMSELLER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+25*Point,0,"JMSELLER",0,0,CLR_NONE);
}

 
You can use MagicNumber() for each order and three different TrailingStop (ex. TrailingStop1,TrailingStop2,TrailingStop3).
When you check orders, check MagigNumber, so
if(MagicNumber()==1&&Bid-OrderStopLoss()>Trailingtop1*Point) OrderModify(...,Bid-TrailingStop1*Point,...)
 
Roger:
You can use MagicNumber() for each order and three different TrailingStop (ex. TrailingStop1,TrailingStop2,TrailingStop3).
When you check orders, check MagigNumber, so
if(MagicNumber()==1&&Bid-OrderStopLoss()>Trailingtop1*Point) OrderModify(...,Bid-TrailingStop1*Point,...)

could you use that in context with the provided script? i still don't understand...

 
deymer:

could you use that in context with the provided script? i still don't understand...

It's probably better to make it EA instead of script

 
deymer wrote >>

i'm trying to write a code that will open 6 trades, 3 buys, and 3 sells.

I have a script set to place orders with a Ask/Bid-15, 20, and 25 stop loss, but i want to add a trailing stop with the same values as the stop loss. How do i do this?

here's the script -

int start()
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-15*Point,0,"JMBUYER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-20*Point,0,"JMBUYER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-25*Point,0,"JMBUYER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+15*Point,0,"JMSELLER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+20*Point,0,"JMSELLER",0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+25*Point,0,"JMSELLER",0,0,CLR_NONE);
}

deymer, consider reading about Client Terminal design and it's single trade thread concepts, as your code will not realise your intentions.

ClientTerminal can only issue one Trade Operation to server at a time. You code must be aware when it is feasible to issue order. The shotgun approach will fail.

 
fbj:

deymer, consider reading about Client Terminal design and it's single trade thread concepts, as your code will not realise your intentions.

ClientTerminal can only issue one Trade Operation to server at a time. You code must be aware when it is feasible to issue order. The shotgun approach will fail.

"ClientTerminal can only issue one Trade Operation to server at a time."


I was just using it today.I executed the script and it placed 6 trades at once, well... they had to load one by one, but still, the shotgun strategy held some merit. I just need to figure out how to add a trailing stop to the initial stop loss...

 
deymer:

"ClientTerminal can only issue one Trade Operation to server at a time."


I was just using it today.I executed the script and it placed 6 trades at once, well... they had to load one by one, but still, the shotgun strategy held some merit. I just need to figure out how to add a trailing stop the the initial stop loss...

bump


how do i add a trailing stop to the following order placement script?


int start()
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-15*Point,0,"JMBUYER",0,0,CLR_NONE);
}

Reason: