My stops and takeprofits are off? EA OrderSend Help

 

Hi everyone, been using this forum a lot in the last months, just registered to have a little question taken out that i havent been able to solve or find solution online.

this is an EA i have been playing for 2 days to detect doji candles (its a code in progress) but im having a problem with the ordersend.

everytime it sends an Ordersend with OP_SELLLIMIT the takeprofit and stoploss its off by 10 pips.

my stops are 40 pips not 50, and my takeprofit is 110 pips not 100.

anyone knows why? i have already looked into....tought maybe the spread...but the spread is about 2 pips....cant figure it out.

Thank you.

//+------------------------------------------------------------------+
//|                                                    LeadingEA.mq4 |
//|                                 Copyright © 2011, OinkOink Soft. |
//|                                                oinquer@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, OinkOink Soft."
#property link      "oinquer@gmail.com"
int StopLevel;
int sinalopen;
int averagewait;
int barras;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

void DrawArrowUp(string name,int TimeD, int Height, int ArrowColor)
{
   ObjectCreate("ArrowUP" + name + Bars + "Arrow",OBJ_ARROW, 0, Time[TimeD], High[Height]+300*Point);
   ObjectSet("ArrowDown" + name + Bars + "Arrow", OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet("ArrowDown" + name + Bars + "Arrow", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
   ObjectSet("ArrowDown" + name + Bars + "Arrow", OBJPROP_COLOR,ArrowColor);
}

void DrawArrowDown(string name, int TimeD, int Height, int ArrowColor)
{
   ObjectCreate("ArrowDown" + name + Bars + "Arrow",OBJ_ARROW, 0, Time[TimeD], Low[Height]-300*Point);
   ObjectSet("ArrowDown" + name + Bars + "Arrow", OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet("ArrowDown" + name + Bars + "Arrow", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);
   ObjectSet("ArrowDown" + name + Bars + "Arrow", OBJPROP_COLOR,ArrowColor);
}

int init()
  {
//----
   StopLevel = MarketInfo(Symbol(), MODE_STOPLEVEL) + MarketInfo(Symbol(), MODE_SPREAD);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {

   if (Open[1]-Close[1] < 0.00015 && Open[1]-Close[1] > -0.00015)
   {
      if (High[1] - (((High[1]-Low[1])*25)/100) < Close[1] && High[1] - (((High[1]-Low[1])*25)/100) < Open[1])
      {
         DrawArrowDown("DragonFly",1,1,Green);
      }
      
       if (Low[1] + (((High[1]-Low[1])*25)/100) > Close[1] && Low[1] + (((High[1]-Low[1])*25)/100) > Open[1])
      {
         if (OrdersTotal() == 0)
         {
            Print(DoubleToStr(Ask+(100*Point),5),"    ",DoubleToStr(Ask+(500*Point),5),"    ",DoubleToStr(Ask-(1000*Point),5));
            OrderSend(Symbol(),OP_SELLLIMIT,0.1,Ask+(100*Point),3,Ask+(500*Point),Ask-(1000*Point),"Buying Order",9912,TimeCurrent()+10000,Green);
            DrawArrowUp("Gravestone",1,1,Green);
                  
         }
      }
      
   }
      
   return(0);
  }
//+------------------------------------------------------------------+
 

OP_SELLLIMIT,0.1,Ask+(100*Point)

You Buy@Ask and Sell@Bid. One way to remember Buy-A...Sell-B. Or A_B. In your code, You're Selling@Ask. Also search Google for 4-5 Digit Broker Code to help you understand Pips vs Points.

 

thank you.

do you have a link to a nice documentation about this? i normally go trough the mql4 documentation but its too shallow most of times....i dont even understand the whole points stuff....i get that if broker is 4 digit its the 1 point per pip for 5 digit its 10 point per pip.


thanks for your time and sending the google search about the 4-5 digit broker, found a script from kolier.

reading it now.

 
Here. Maybe this will help.
Reason: