if shutdown the computer and when i open it ea again sending order again . how can i stop it forex

 
if shutdown the computer and when i open it ea again sending order . how can i stop it forex
 
amitkk:
if shutdown the computer and when i open it ea again sending order . how can i stop it forex


Hi buddy,

Your problem seems to start .... from the start. You set StartEA to false and wonder why it is still starting.

Look at the code that is supposed to execute if !StartEA :

   if(!StartEA)
     {
      Comment("Reverse Grid martingale by Constin@ForexFactory, mod. http://ForexBaron.net --> EA is waiting for "+sStartPrice+
              DoubleToStr(StartBidPrice,Digits)+"\n"
              +"Longs: "+openLongs+" shorts: "+openShorts+
              " reported longs:"+openPositions(OP_BUY)+" reported shorts:"+openPositions(OP_SELL)); CheckForStartEA();
     }

The very last call is to the CheckForStartEA();

Let's see what that function does (remember, your settings say : extern int StartPriceMode=1;) :

void CheckForStartEA()
  {
   RefreshRates();
   if(StartPriceMode==0 && Bid>=StartBidPrice) StartEA=true;        // not the case her
   else if(StartPriceMode==1 && Bid<=StartBidPrice) StartEA=true;   // Bid will never be < zero ?!
   else if(StartBidPrice==0.0000) StartEA=true;                     // bingo  
   if(!StartEA) return;
   if(LongOnly) PlaceLongOrders(); if(ShortOnly) PlaceShortOrders();
   return;
  }

In case you still don't see it, here it is :

else if(StartBidPrice==0.0000) StartEA=true;

so you say extern bool StartEA=false;but then it says start if StartBidPrice=0.0 so the result is ? You have 1 guess ! Exactly, start EA.

And that's why the EA starts even if the StartEA is set to false.

Does it make sense to you ?

Here is something else not quite right :

void updatePositionCounts()
  {
   openLongs=openPositions(OP_BUY);

so openLongs are the open positions (OP_BUY). And in check() :

void check()
  {
   if((openPositions(OP_BUY)<openLongs))

Do you see the problem there ? It's like saying : if OP_BUY < OP_BUY ?! Not going to work.

Hope it helps.

 
thanks