Error 4107 with OrderSend (Where Am I getting it wrong?)

To add comments, please log in or register
andre.costa101
35
andre.costa101  

Hello guys...

I'm a newbie on this, so I guess my error could be fairly simple:

I want to put a pending order at a certain distance from a point I will call "Anchor".

So:

extern double Anchor = 1.0;     // Initial point  where I will manually enter a price like: 1.17293

extern double Distance = 5;   // the distance which I will indicate

int OnInit()

  {

  

         if(Digits == 5 || Digits == 3 || Digits == 1)P = 10;else P = 1; // To account for 5 digit brokers



          double Entry = Anchor - Distance;  // just to simplify the price in the order;

         ticket = OrderSend(NULL,OP_SELLSTOP,Lots,Entry*Point,Sllpg,StopL,TakeP,NULL,MagicNumber,0,clrBlue);

}

Where is the error?

Andrey Barinov
39896
Andrey Barinov  
andre.costa101:

Hello guys...

I'm a newbie on this, so I guess my error could be fairly simple:

I want to put a pending order at a certain distance from a point I will call "Anchor".

So:

Where is the error?

Try doing like this:

extern double Anchor = 1.0;     // Initial point  where I will manually enter a price like: 1.17293

extern double Distance = 5;   // the distance which I will indicate

int OnInit()

  {

  

         if(Digits == 5 || Digits == 3 || Digits == 1)P = 10;else P = 1; // To account for 5 digit brokers



          double Entry = Anchor - (Distance*Point);  // just to simplify the price in the order;

         ticket = OrderSend(NULL,OP_SELLSTOP,Lots,NormalizeDouble(Entry,Digits),Sllpg,StopL,TakeP,NULL,MagicNumber,0,clrBlue);

}
To add comments, please log in or register