Invalid Stops in my EA Index

 

Hello I'm a beginner just started to code my very simple EA for index trading and get confused with an error with my code.

2018.06.28 09:12:33.787 2016.12.10 13:10:00   failed market buy 0.01 Volatility 75 Index tp: 21257.4562 [Invalid stops]
And here's my code :
//+------------------------------------------------------------------+
//|                                              SimpleBuyAction.mq5 |
//|                                              Copyright 2018, JBT |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, JBT"
#property link      "https://www.mql5.com"
#property version   "1.00"

#include <Trade\Trade.mqh>

CTrade trade;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK), _Digits);
   double Balance=AccountInfoDouble(ACCOUNT_BALANCE);
   double Equity=AccountInfoDouble(ACCOUNT_EQUITY);
   
   if(Equity >= Balance)
     {
      trade.Buy(0.01, NULL, Ask, 0, (Ask+100 * _Point),NULL);
     }
  }
//+------------------------------------------------------------------+

Is it because I code it for index not for forex so it causes the error ? Thanks


*EDIT

In case this is helpful for you.


 

Hi 

Everything seems to be alright, but please check up on the implementation of this function 

trade.Buy(0.01, NULL, Ask, 0, (Ask+100 * _Point),NULL);

Your Stop loss or even your take profit seems to be too out of reach (too large). 

Reason: