[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 216

 

so you've been told, haven't you?

Open a Buy order - remember the Ticket of this order

set a SellStop order - write the Ticket of this order in the Magik of this order...

---

call the function at the start to check the presence of the buy order according to the magik in the SellStops...

if there is no such an order (buy) - delete the SellStop...

it only takes 15 lines of code...

 
Top2n:

Gentlemen, I haven't been able to get an inch closer to solving this problem all day long.

How to implement this algorithm into code?


Is there a condition if the market is 2, then the pending order is deleted?
 
ZS - if the code isn't big... put it all in here... maybe I'll take the trouble to insert these lines....
 
Aleksander:
ZS - if the code isn't big... put it all in here... maybe I'll take the trouble to insert these lines....

Maybe you won't be too lazy to look at my indicator code too, code posted above.
 
Aleksander:

so you were already told, weren't you?

opened Buy order - remember the Ticket of this order

set a SellStop Order - write the Ticket of the Buy Order in the Magik of this Order...

---

call the function at the start to check if the buy order is in the magik in the SellStops...

if there is no buy order - delete SellStop...

15 lines of code...

I'm sorry for being blunt, but how do I memorise it, it's just that there's probably more than one and there are five of them to memorise at once when the EA is running.
 
come on.... post your grail... there are 100's of these a day... I'll show you in red where to put it and where to check :-)
 
//----балансир (установка ордеров)
 if (sig==0){
  x=true;
  y=true;
}
 if (sig==1 && x==true){
  ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage,0,0,   // Ask - SL * Point, Ask + TP * Point,
  "хи-хи"+ Symbol(), Magic, 0, DarkGreen);
  x=false;
  z=true;
}

//----маневр (установка отложенных ордеров)
  
 if(x==false && z==true){
  
  ticket = OrderSend(Symbol(), OP_SELLSTOP, Lots,PriceOpenLastPos(NULL,-1,-1)-(Price*Point), Slippage,0,0,  // Ask - SL * Point, Ask + TP * Point,
  "хи-хи"+ Symbol(), Magic+1, 0, DarkGreen);
  z=false;
}
I've only got the Bye so far))
 
Top2n:
I have so far only with Bai))

well, for starters, opening trades with their ticket memorized in magik...

get rid of unnecessary checks... - if real - we should add a couple of seconds break between orders.... for a tester - doesn't matter.

  //----балансир (установка ордеров)
  if (sig==0){   x=true;   y=true; }
  //
  if (sig==1 && x==true){
     ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage,0,0, "хи-хи"+ Symbol(), Magic, 0, DarkGreen);
     x=false;  z=true;
     //---- wait for 3 seconds
     Sleep(3000);
     //----маневр (установка отложенных ордеров)
     // Ask - SL * Point, Ask + TP * Point,
     OrderSend(Symbol(), OP_SELLSTOP, Lots,PriceOpenLastPos(NULL,-1,-1)-(Price*Point), Slippage,0,0, "хи-хи"+ Symbol(), ticket, 0, DarkGreen);
     z=false;
  }

Although we should get rid of the extra flags... from Z... if nowhere else is used...

 
at start - call the function to check if there is a buy order in the SellStop order loop... and remove it - if there is no buy order amongst the open orders...
 

Question for the developers:

I have a 427th build of the terminal. I've sketched out a small script:

datetime VremaOrdera= InitsializeRealMasterOrders();
string SSStroka;
SSStroka=StringConcatenate(TimeYear(VremaOrdera),".",TimeDay(VremaOrdera),"     ",TimeHour(VremaOrdera),":",TimeMinute(VremaOrdera),"  :",TimeSeconds(VremaOrdera));
Alert("Поступило время ордера = ",VremaOrdera," что соответствует времени ",SSStroka);

The script produced the following:

But alas, the order is open:

What kind of glitch is this? The script returned the time - zero hours, zero minutes and zero seconds.