So it is assumed that you have a minimum of 8 different trawl settings? And what criteria are used to determine to which newly opened position a specific setting should be applied?
granit77: So it is assumed that you have at least 8 different settings for a trawl? And what criteria are used to determine which newly opened position a particular setting should be applied to?
max 8, I tried it with the ticket, the ticket is different for everyone
charony: 8 at the most, I tried the ticket, everyone's ticket is different
Slowly and word by word... The first position opened, how does Expert Advisor know which parameters should be applied to it? The second position has opened; how does the Expert Advisor know what parameters should be applied to it? Why aren't they the same as those of the first position? What does it depend on? The third position opened...
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position OrderSymbol()==Symbol()) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
else// go to short position
{
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
granit77: Slowly and word by word... The first position is opened, how does Expert Advisor know what parameters should be applied to it? The second position has opened; how does the Expert Advisor know what parameters should be applied to it? Why aren't they the same as those of the first position? What does it depend on? The third position opened...
And so on. And only then, how to implement it.
I have explained to all positions 50 points of trawl
a maximum of 8 positions
For each position, you will need a separate variable for the value, for the trawl and for the majiks
How would it look in the code?
Why do you need a unique number for a majik, isn't it enough?
So it is assumed that you have at least 8 different settings for a trawl? And what criteria are used to determine which newly opened position a particular setting should be applied to?
max 8, I tried it with the ticket, the ticket is different for everyone
for the trawl one setting for all 50 points
How would it look in the code?
Why do you need it for majik? Isn't the ticket a unique number?
It wouldn't look that good.
If we use one majik for every position, it will be the same for all positions.
If you take a ticket, how will the trawl know it's his position, or if the position closes and a new one opens?
8 at the most, I tried the ticket, everyone's ticket is different
The first position opened, how does Expert Advisor know which parameters should be applied to it?
The second position has opened; how does the Expert Advisor know what parameters should be applied to it? Why aren't they the same as those of the first position? What does it depend on?
The third position opened...
And so on.
And only then, how to implement it.
charony:
max 8, I tried by ticket, ticket is different for everyone
for trawl one setting for all 50 points
so what's the problem?
for each position a separate trail or for all positions one trail (trail of the same size)?
ZS: if the second, there is an example in the standard MACD_Simple Expert Advisor
or if the position closes and a new one opens?
the ticket will be different
Slowly and word by word...
The first position is opened, how does Expert Advisor know what parameters should be applied to it?
The second position has opened; how does the Expert Advisor know what parameters should be applied to it? Why aren't they the same as those of the first position? What does it depend on?
The third position opened...
And so on.
And only then, how to implement it.
I have explained to all positions 50 points of trawl