Grand capital binary options ordersend in mt4

The dealer allows 1 minute expirations and better.

Is this even feasible?

#assets copyright “”#assets hyperlink      “”#assets version   “”#belongings description “”

#consist of #encompass

int MagicNumber = 123456;extern double Investment_or_Lots = zero.1;extern int BO_Expiration_Seconds = 60;extern int Forex_Expiration_Minutes = 15; //most trade durationextern int Period1 = 21;extern int MA_Shift = 0;extern int Candle_Close = 1;int LotDigits; //initialized in OnInitdouble MM_Martingale_ProfitFactor = 1;extern int Use_Martingale = 3;extern double MM_Martingale_LossFactor = 2;bool MM_Martingale_RestartProfit = true;bool MM_Martingale_RestartLoss = false;

int MaxSlippage = 3; //adjusted in OnInitint MaxOpenTrades = 1;int MaxLongTrades = 1;int MaxShortTrades = 1;int MaxPendingOrders = 1;bool Hedging = genuine;int OrderRetry = five; //# of retries if sending order returns errorint OrderWait = 5; //# of seconds to wait if sending order returns errordouble myPoint; //initialized in OnInit

void CloseByDuration(int sec) //near trades opened longer than sec seconds     if(!IsTradeAllowed()) return;   bool achievement = fake;   int err;   int general = OrdersTotal();   for(int i = general-1; i >= zero; i–)           while(IsTradeContextBusy()) Sleep(a hundred);      if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) keep;      if(OrderMagicNumber() != MagicNumber retain;      even as(IsTradeContextBusy()) Sleep(one hundred);      RefreshRates();      double rate = Bid;      if(OrderType() == OP_SELL)         fee = Ask;      achievement = OrderClose(OrderTicket(), NormalizeDouble(OrderLots(), LotDigits), NormalizeDouble(charge, Digits()), MaxSlippage, clrWhite);      if(!achievement)                 err = GetLastError();         myAlert(“error”, “OrderClose failed; mistakes #”+err+” “+ErrorDescription(err));                if(achievement) myAlert(“order”, “Orders closed with the aid of duration: “+Symbol()+” Magic #”+MagicNumber); 

double MM_Size() //martingale / anti-martingale     double plenty = Investment_or_Lots;   double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);   double MinLot = MarketInfo(Symbol(), MODE_MINLOT);   if(SelectLastHistoryTrade())           double orderprofit = OrderProfit();      double orderlots = OrderLots();      double boprofit = BOProfit(OrderTicket());      if(orderprofit + boprofit > 0 && !MM_Martingale_RestartProfit)         lots = orderlots * MM_Martingale_ProfitFactor;      else if(orderprofit + boprofit MaxLot) plenty = MaxLot;   if(masses < MinLot) lots = MinLot;   go back(masses); 

void myAlert(string kind, string message)     if(type == “print”)      Print(message);   else if(kind == “errors”)           Print(kind “+message);        else if(kind == “order”)             else if(type == “alter”)           

int TradesCount(int kind) //returns # of open trades for order kind, modern symbol and magic number     int result = 0;   int overall = OrdersTotal();   for(int i = 0; i < total; i++)           if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == fake) maintainkind) preserve;      result++;        return(result); 

bool SelectLastHistoryTrade()     int lastOrder = -1;   int total = OrdersHistoryTotal();   for(int i = total-1; i >= 0; i–)           if(!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) keep;      if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)                 lastOrder = i;         break;                return(lastOrder >= zero); 

bool ConsecutiveLosses(int n)     int matter = zero;   int total = OrdersHistoryTotal();   for(int i = total-1; i >= 0; i–)           if(!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) retain;      if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)                 double orderprofit = OrderProfit();         double boprofit = BOProfit(OrderTicket());         if(orderprofit + boprofit >= 0)            ruin;         depend++;                go back(count >= n); 

int myOrderSend(int type, double rate, double quantity, string ordername) //send order, return price tag (“price” is irrelevant for marketplace orders)     if(!IsTradeAllowed()) go back(-1);   int ticket = -1;   int retries = zero;   int err;   int long_trades = TradesCount(OP_BUY);   int short_trades = TradesCount(OP_SELL);   int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP);   int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP);   string ordername_ = ordername;   if(ordername != “”)      ordername_ = “(“+ordername+”)”;   //test Hedging   if(!Hedging && ((kind % 2 == 0 && short_trades + short_pending > 0) type % 2 == 1 && long_trades + long_pending > 0)))           myAlert(“print”, “Order”+ordername_+” no longer sent, hedging no longer allowed”);      go back(-1);        //check maximum trades   if((type % 2 == 0kind (long_trades + short_trades >= MaxOpenTrades)   type > 1 && long_pending + short_pending >= MaxPendingOrders))           myAlert(“print”, “Order”+ordername_+” now not despatched, most reached”);      go back(-1);        //prepare to send order   at the same time as(IsTradeContextBusy()) Sleep(one hundred);   RefreshRates();   if(kind == OP_BUY)      fee = Ask;   else if(type == OP_SELL)      charge = Bid;   else if(fee < zero) //invalid charge for pending order           myAlert("order", "Order"+ordername_+" not sent, invalid fee for pending order");   go back(-1);        int clr = (kind % 2 == 1) ? clrRed : clrBlue;   at the same time as(ticket < 0 && retries < OrderRetry+1)           price tag = OrderSend(Symbol(), kind, NormalizeDouble(quantity, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, zero, 0, ordername, MagicNumber, 0, clr);      if(price ticket < zero)                 err = GetLastError();         myAlert("print", "OrderSend"+ordername_+" blunders #"+err+" "+ErrorDescription(err));         Sleep(OrderWait*a thousand);              retries++;        if(price ticket = 1) LotDigits = zero;   else if(LotStep >= zero.1) LotDigits = 1;   else if(LotStep >= zero.01) LotDigits = 2;   else LotDigits = 3;   go back(INIT_SUCCEEDED); 

//+——————————————————————+//function//+——————————————————————+void OnDeinit(const int motive)    Expert tick feature//+——————————————————————+void OnTick()     int price ticket = -1;   double price;         CloseByDuration(Forex_Expiration_Minutes * 60);      //Binary Option Call   if(Close[Candle_Close] > iMA(NULL, PERIOD_CURRENT, Period1, MA_Shift, MODE_SMA, PRICE_CLOSE, 0) //Candlestick Close > Moving Average   )           RefreshRates();      price = Ask;         if(IsTradeAllowed())                 price ticket = myOrderSend(OP_BUY, charge, MM_Size(), “BO exp:”+IntegerToString(BO_Expiration_Seconds * 1)); //binary choice order         if(ticket handiest ship alert         myAlert(“order”, “”);           //Binary Option Put   if(Close[Candle_Close] < iMA(NULL, PERIOD_CURRENT, Period1, MA_Shift, MODE_SMA, PRICE_CLOSE, zero) //Candlestick Close < Moving Average   )           RefreshRates();      fee = Bid;         if(IsTradeAllowed())                 price tag = myOrderSend(OP_SELL, charge, MM_Size(), "BO exp:"+IntegerToString(BO_Expiration_Seconds * 1)); //binary option order         if(ticket simplest send alert         myAlert(“order”, “”);       //+——————————————————————+

strive replacing ordername with “1”

and do away with all other expressions that encompass ordername except within the real OrderSend

I am now not certain what you mean via casting off all expressions of ordername.

And once I add the input do I nevertheless hold the 1 within the price tag line rather than ordername:

Below are some highlighted examples of in which ordername is discovered, however I don’t recognize how to dispose of it from the choices code.

ordername is mentioned approximately thirteen times in the code above.

   if(!IsTradeAllowed()) go back(-1);   int price tag = -1;   int retries = 0;   int err;   int long_trades = TradesCount(OP_BUY);   int short_trades = TradesCount(OP_SELL);   int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP);   int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP);   string ordername_ = ordername;   if(ordername != “”)      ordername_ = “(“+ordername+”)”;   //check Hedging   if(!Hedging && ((type % 2 == 0 && short_trades + short_pending > zero) type % 2 == 1 && long_trades + long_pending > 0)))           myAlert(“print”, “Order”+ordername_+” not sent, hedging now not allowed”);      go back(-1);        //test most trades   if((type % 2 == zero && long_trades >= MaxLongTrades)   kindkind > 1 && long_pending + short_pending >= MaxPendingOrders))           myAlert(“print”, “Order”+ordername_+” now not despatched, most reached”);

I think you don’t have any concept what your code is doing.

Ask the choices proprietor of the choices code or attempt to recognize how it works.

I regarded nearer at the EA and I consider that you already have an input

even though this appears to be minutes, now not seconds, so the default 60 would set 1 hour, no longer 60 seconds. If you place this input to one on your authentic published EA it ought to expire after 1 minute.

Below I brought a simple binary options ea (a bit of junk playing ea) that I created just for the cause of posting here to look if a person can add a

I consider eddie above and don’t see how you could have created this EA and no longer regarded which you had already protected the choices input.

Very authentic I have no concept approximately ea coding, but I created the choices ea using EABuilder which does most of the paintings to your routinely.

As is the ea trades binary options MT4 agents like GDMFX, MikiForex and so on., however Grand capital is installation differently in order that the choices EA expiration time on that dealer works in a different way given that that dealer does no longer use the TradeToolsFX MT4 binary options plugin.

The regular expiration time (Bo_Expiration_Seconds) is in seconds, not minutes.

So with GDMFX, MikiForex and many others. a 1 minute expiration is 60 within the Bo_Expiration_Seconds enter.

BUT GUMRAI you’re correct. I used 1 2d in the Bo_Expiration_Seconds input, and it labored as a 1 minute expiration with Grand Capital.

With different MT4 binary options agents 3600 in that input might be a 60 minute expiration.

Thank you for your assist.

You conform to website coverage and phrases of use

Allow the usage of cookies to log in to the choices MQL5.com internet site.

Please enable the choices vital placing to your browser, otherwise you may now not be able to log in.