I need help with my ea

 

Hello i have made a ea from a custom indicator. I just do not get it working. It is an EA for binary options in mt4 . It is intended that the trade remains open for 15 minutes and then closes automatically. It is for 15min time frame . I would love it if someone could help me . Below I put the source code I have so far. it is the broker core liquidity , here you can also test . The custom indicator is binary comodo . Do you have any questions? they suggest me please. I hope someone knows the solution to help me . Thanks ! Here the code





//+------------------------------------------------------------------+ //| Strategy: kkkk.mq4 | //| Created with EABuilder.com | //| http://eabuilder.com | //+------------------------------------------------------------------+ #property copyright "Created with EABuilder.com" #property link "http://eabuilder.com" #property version "1.00" #property description "" #include #include int LotDigits; //initialized in OnInit int MagicNumber = 1176611; double MM_Percent = 2; int MaxSlippage = 3; //adjusted in OnInit int MaxOpenTrades = 1000; int MaxLongTrades = 1000; int MaxShortTrades = 1000; int MaxPendingOrders = 1000; bool Hedging = true; int OrderRetry = 5; //# of retries if sending order returns error int OrderWait = 5; //# of seconds to wait if sending order returns error double myPoint; //initialized in OnInit double MM_Size(double SL) //Risk % per trade, SL = relative Stop Loss to calculate risk { double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT); double MinLot = MarketInfo(Symbol(), MODE_MINLOT); double tickvalue = MarketInfo(Symbol(), MODE_TICKVALUE); double ticksize = MarketInfo(Symbol(), MODE_TICKSIZE); double lots = MM_Percent * 1.0 / 100 * AccountBalance() / (SL / ticksize * tickvalue); if(lots > MaxLot) lots = MaxLot; if(lots < MinLot) lots = MinLot; return(lots); } void myAlert(string type, string message) { if(type == "print") Print(message); else if(type == "error") { Print(type+" | kkkk @ "+Symbol()+","+Period()+" | "+message); } else if(type == "order") { } else if(type == "modify") { } } int TradesCount(int type) //returns # of open trades for order type, current symbol and magic number { int result = 0; int total = OrdersTotal(); for(int i = 0; i 0) || (type % 2 == 1 && long_trades + long_pending > 0))) { myAlert("print", "Order"+ordername_+" not sent, hedging not allowed"); return(-1); } //test maximum trades if((type % 2 == 0 && long_trades >= MaxLongTrades) || (type % 2 == 1 && short_trades >= MaxShortTrades) || (long_trades + short_trades >= MaxOpenTrades) || (type > 1 && long_pending + short_pending >= MaxPendingOrders)) { myAlert("print", "Order"+ordername_+" not sent, maximum reached"); return(-1); } //prepare to send order while(IsTradeContextBusy()) Sleep(100); RefreshRates(); if(type == OP_BUY) price = Ask; else if(type == OP_SELL) price = Bid; else if(price < 0) //invalid price for pending order { myAlert("order", "Order"+ordername_+" not sent, invalid price for pending order"); return(-1); } int clr = (type % 2 == 1) ? clrRed : clrBlue; while(ticket < 0 && retries < OrderRetry+1) { ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr); if(ticket < 0) { err = GetLastError(); myAlert("print", "OrderSend"+ordername_+" error #"+err+" "+ErrorDescription(err)); Sleep(OrderWait*1000); } retries++; } if(ticket = 1) LotDigits = 0; else if(LotStep >= 0.1) LotDigits = 1; else if(LotStep >= 0.01) LotDigits = 2; else LotDigits = 3; return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int ticket = -1; double price; double TradeSize; //Binary Option Call if(iCustom(NULL, PERIOD_CURRENT, "BinaryComodo", 5, 200, 12, false, 0, 0) > 0 //BinaryComodo > fixed value ) { RefreshRates(); price = Ask; if(IsTradeAllowed()) { ticket = myOrderSend(OP_BUY, price, TradeSize, "BO exp:"+IntegerToString(15 * 60)); //binary option order if(ticket only send alert myAlert("order", ""); } //Binary Option Put if(iCustom(NULL, PERIOD_CURRENT, "BinaryComodo", 5, 200, 12, false, 1, 0) > 0 //BinaryComodo > fixed value ) { RefreshRates(); price = Bid; if(IsTradeAllowed()) { ticket = myOrderSend(OP_SELL, price, TradeSize, "BO exp:"+IntegerToString(15 * 60)); //binary option order if(ticket only send alert myAlert("order", ""); } } //+------------------------------------------------------------------+

Files:
 
here is the ea
 
barthanhere: Hello i have made a ea from a custom indicator. I just do not get it working.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. That's the first thing. Don't do that. Just get the value of the indicator. Detailed explanation of iCustom - MQL4 forum
  3. The second thing is you didn't make it.
    copyright "Created with EABuilder.com"
    • We hate EA builder
    • You couldn't be bothered to learn mql4, therefor there is no common language for us to communicate.
    • There are only two choices: learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds lines of code.
    • EA builder makes bad code counting up while closing multiple orders.
    • EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time
    • EA builder makes bad code Not adjusting for 4/5 digit brokers
    • EA builder makes bad code not adjusting for ECN brokers.
    • EA builder makes bad code not checking return codes.
    • EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/reboot.)
  4. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  5. Once you fix checking your return codes, you may have enough information to fix it.