HELP WHO CAN !!! - page 4

 

I'd like to know an Expert Advisor like this... it opens 2 different pending orders and closes the rest when one of them triggers...

there used to be a code base double pending 2 called ... now there is no ...

 
Techno:
what he means is that he has all the operations on all the orders mixed up in one loop, with one iteration significantly affecting the result of the other, and he can't understand why it all doesn't work.

So we have to separate the cutlets from the flies first... I didn't think of such chaos :-)
 
sllawa3:

I'd like to know an Expert Advisor like this... it opens 2 different pending orders and closes the rest when one of them triggers...

there was a pending 2 in the code was called ... not anymore ...


loop through the open orders by OrderType() and set the counter:

int count=0;

if(OrderType()<2) count++;

if(count==0)

{ here is a selector - as soon as you come across OrderType()>1 - delete it: OrderDelete(.....); if deletion is successful (see documentation), set active: OrderSend(...); } Elementary, Watson!

I got you a little wrong: if(OrdersTotal()==0) {place 2 pending orders} and then check with the order type selector : once you've found one <2, look for the second >2 and delete it

 

Here is a loop to check the state of the orders, after that do checks and closes and modifications, after each action return operator to make the loop update the state of the orders

for(int i=0;i<OrdersTotal();i++)
        {
          if(OrderSelect(i,SELECT_BY_POS)&&OrderSymbol()==Symbol()&&OrderMagicNumber()==MAGA)
          switch(OrderType())
          {
          case 0:DB=1;break;
          case 1:DS=1;break;
          case 4:ZB=1;break;
          case 5:ZS=1;break;
          }
        }
 
OK... I understand that you can't help me... it's useless to give advice until I see it anyway... I'll look for a similar one (it doesn't work with this check cycle either... everything remains the same... and even with several loops per operation...)
 
ANY LOOP THAT DOESN'T START WILL SHOW THE LAST VALUE OF THE VARIABLE... AND IT WON'T START IF THERE IS NO ORDER
 
sllawa3:
ok... i figured you won't be much help... it's useless to give advice until i see it anyway... i'll look for a similar one ( it doesn't work with this check loop either... all is the same... and even with several loops per operation...)

You've become lazy... write a function (or two, if you don't know how) that returns the number of orders in the market (history) according to the given parameters: symbol, magician, order type, i.e., in any combinations...

then on every tick (or other time frame where the EA starts) you define the number of orders in the market and pending orders and using their combinations perform the following actions

market == 0 and pending orders == 0

market == 0 and pending orders == 2 do nothing

market == 1 and pending orders == 1 delete a pending order

market == 1 and pauses == 0 bait

i can't believe it's so hard to do ...


sorry. it's time to forget about procedural programming - use functions...

a variable saves the last value, it's ridiculous...

 

THERE IS NO PROBLEM IN THE HISTORY BUT HOW DO I KNOW IF IT'S OPEN OR NOT? IF THE SELECTOR KEEPS THE LAST VALUE UNTIL IT IS RESTARTED...

IT'S BUTTERY.

 
sllawa3:
THERE IS NO PROBLEM IN THE HISTORY BUT HOW DO I KNOW IF IT'S OPEN OR NOT? IF THE SELECTOR KEEPS THE LAST VALUE UNTIL IT IS RESTARTED...
you've already been told 5 times how to do it by 3 people, if you don't understand, look for a ready-made one, or get someone to write it for you
 
IT'S NOT JUST THIS EA THAT'S THE PROBLEM, IT'S ANY EA... THAT UNTIL THE SELECTOR IS RESTARTED (UNTIL THE ORDER APPEARS) IT WILL HAVE THE LAST VALUE STUCK IN IT
Reason: