Download MetaTrader 5

Help me with iCustom function

To add comments, please log in or register
Find out how your rating can be improved
Marco Ebrahim
152
Marco Ebrahim 2016.05.28 22:56 

Hi all, i am very new with mql4. i am trying to make EA open trades depend on an indicator
the indicator Code:

<De-compiled code removed>

 i try to take the indicator output to my EA with this code

//+------------------------------------------------------------------+
//|                                                       FastGo.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#include <Korp0.1.mqh>

input int MagicB1 = 12;
input int MagicB2 = 123;
input int MagicS1 = 111;
input int MagicS2 = 1211;
input int timeFrame = 60;
input int noofbars = 80;
static int bars;
static int bbars;
int BarsNow;


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   SetLotDecimalSlipingPoint();
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
 double Buy1=iCustom(NULL,0,"price_channel_signal",3,0,0,0);
 double Sell1 = iCustom(NULL,0,"price_channel_signal",1,0);
 double Buy2 = iCustom(NULL,0,"price_channel_signal",2,0);
 double Sell2 = iCustom(NULL,0,"price_channel_signal",3.0,0,3,0);
Alert("Buy1: ", Buy1);
Alert("Buy2: ", Buy2);

 if(Buy1 > 0.1)
   {
    if(MyOrdersTotal(MagicB2) == 1) CloseAll(sliping,MagicB2);
    if(MyOrdersTotal(MagicS1) == 1) CloseAll(sliping,MagicS1);
    if(MyOrdersTotal(MagicS2) == 1) CloseAll(sliping,MagicS2);
    if(MyOrdersTotal(MagicB1) == 0) OpenBuyOrder(MagicB1);
   }
 if(Sell1 >0.1)
   {
    if(MyOrdersTotal(MagicB1) == 1) CloseAll(sliping,MagicB1);
    if(MyOrdersTotal(MagicB2) == 1) CloseAll(sliping,MagicB2);
    if(MyOrdersTotal(MagicS2) == 1) CloseAll(sliping,MagicS2);
    if(MyOrdersTotal(MagicS1) == 0) OpenBuyOrder(MagicS1);
   }
   
 if(Buy2 > 0.1)
   {
    if(MyOrdersTotal(MagicB1) == 1) CloseAll(sliping,MagicB1);
    if(MyOrdersTotal(MagicS1) == 1) CloseAll(sliping,MagicS1);
    if(MyOrdersTotal(MagicS2) == 1) CloseAll(sliping,MagicS2);
    if(MyOrdersTotal(MagicB2) == 0) OpenBuyOrder(MagicB2);
   }
   
 if(Sell2 > 0.1)
   {
    if(MyOrdersTotal(MagicB1) == 1) CloseAll(sliping,MagicB1);
    if(MyOrdersTotal(MagicB2) == 1) CloseAll(sliping,MagicB2);
    if(MyOrdersTotal(MagicS1) == 1) CloseAll(sliping,MagicS1);
    if(MyOrdersTotal(MagicS2) == 0) OpenBuyOrder(MagicS2);
   }
   
 
//---
  }
//+------------------------------------------------------------------+

 but the value i get from ICustom Function is the same and equal to 2147483647.0

any one can help me finding the problem please

whroeder1
14532
whroeder1 2016.05.28 23:28  
if (G_ibuf_124[Li_8 + 2] > 0.0 && (!Gi_132)) {

Variable names like those indicate decompiled code. Ask the owner of the indicator to give source code to you.

Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317

If you post decompiled code again, you will likely be banned.

Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because "someone uploaded it, I don't know why I can't use that"?

Keith Watford
Moderator
9650
Keith Watford 2016.05.29 01:55  
 double Buy1=iCustom(NULL,0,"price_channel_signal",3,0,0,0);
 double Sell1 = iCustom(NULL,0,"price_channel_signal",1,0);
 double Buy2 = iCustom(NULL,0,"price_channel_signal",2,0);
 double Sell2 = iCustom(NULL,0,"price_channel_signal",3.0,0,3,0);

Why the different parameter count for the iCustom calls?

2147483647 is how EMPTY_VALUE is expressed.

Marco Ebrahim
152
Marco Ebrahim 2016.05.29 06:53  
WHRoeder:

Variable names like those indicate decompiled code. Ask the owner of the indicator to give source code to you.

Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317

If you post decompiled code again, you will likely be banned.

Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because "someone uploaded it, I don't know why I can't use that"?

I am sorry, as i said i am new in mql4 and i don't know what decompiled code mean. i will not use this indicator or try to find the owner. thank you for warning. 
ceaser234
56
ceaser234 2016.05.29 18:21  

Hey!

I am suffering from the same problem.Here is my iCustom line code.

double ssa = iCustom(NULL,0,"Corridor SSA normalized end-pointed 2 nmc__1","Current time frame",PRICE_CLOSE,25,2,25,300,400,0.005,0,1);

 and here is the indicator.

Can anyone tell me the problem causing the error and can help me to solve.

Janek6191
29
Janek6191 2016.05.29 18:24  

As above, this number indicates that there is an EMPTY_VALUE returned from your indicator. In most cases it means that there is no signal given from your indicator at that moment.


Open random chart, put your indicator on and display data window.

It's located on the left to the icon with yellow folder and a star that let you open the file tree.

Then as you move your mouse around the chart you will see exactly what your indicator outputs from every buffer. If there is some empty field that means EMPTY_VALUE.


I tried this indicator and it doesn't even draw. Do you see anything after you put it on a chart. This indicator is most likely broken - you probably need to fix it's code first.

whroeder1
14532
whroeder1 2016.05.29 21:13  
ceaser234: I am suffering from the same problem.Here is my iCustom line code.
double ssa = iCustom(NULL,0,"Corridor SSA normalized end-pointed 2 nmc__1","Current time frame",PRICE_CLOSE,25,2,25,300,400,0.005,0,1);

Janek6191: In most cases it means that there is no signal given from your indicator at that moment.
No signal for buffer zero in bar 1. Your indicator has multiple buffers. Detailed explanation of iCustom - MQL4 forum
ceaser234
56
ceaser234 2016.05.29 21:26  
WHRoeder:
No signal for buffer zero in bar 1. Your indicator has multiple buffers. Detailed explanation of iCustom - MQL4 forum
There are total 5 buffers in the indicator.I have tried all five buffers to get the value but that EMPTY_VALUE is obtained all the time.
ffoorr
1017
ffoorr 2016.05.30 08:16  

corridorbssatnormalizedpend-pointedj2jnmc__1.mq4  (8.19 KB)

There is a problem with the name of the indicator, it seem MT4 replace the empty space with some letter

change the name of the indi :

   double ssa = iCustom(NULL,0,"Corridor_SSA_normalized_end-pointed_2_nmc_1","Current time frame",PRICE_CLOSE,25,2,25,300,400,0.005,0,1);

And to have a signal use the buffer number 6 this way :

if( buffer_six_2 >0 &&  buffer_six_1 <0 ) get_some_signal on bar 1

ceaser234
56
ceaser234 2016.05.30 10:24  
ffoorr:

corridorbssatnormalizedpend-pointedj2jnmc__1.mq4 (8.19 KB)

There is a problem with the name of the indicator, it seem MT4 replace the empty space with some letter

change the name of the indi :

And to have a signal use the buffer number 6 this way :

if( buffer_six_2 >0 &&  buffer_six_1 <0 ) get_some_signal on bar 1

I have changed the name of the indicator but the same problem persist. It is giving me the same EMPTY_VALUE.I have also test it on different terminals , charts and period but the same EMPTY_VALUE is obtained all the time.
ceaser234
56
ceaser234 2016.05.30 12:11  
WHRoeder:
This forum changed the name not MT4. The name in the iCustom (without the extension) must match the name of the file.
I tried both the way without the named changed and by changing name but the problem is not solved.It always returned an EMPTY_VALUE. Any solution.
12
To add comments, please log in or register