Download MetaTrader 5

Problem with iCustom :-(

To add comments, please log in or register
magic6666
16
magic6666  

Hi Guys ,

   I am new in Programing , and want use from an Indicator ( its name is Trend Signal ) , and Signal Line , I tried use iCustom in my EX but it don't give any data , I will be very thankful if you say me where is my wrong .

//+------------------------------------------------------------------+
//|                                                          M.mq4 |
//|                                                            G |
//|                                           https://www.mql555.com |
//+------------------------------------------------------------------+



#property copyright "G"
#property link      "https://www.mql555.com"
#property version   "1.00"
#property strict

extern int Signal_line_period=10;
extern int Signal_line_method=3;
extern int Signal_line_price=0;
//FS30Range,FilterPeriod,MartFiltr,PriceConst,MaPeriod,MaMode,LevelsCross,Countbars,true,ArrowUp,ArrowDn

extern int FS30Range =5;
extern int FilterPeriod=17;
extern double MartFiltr=2.0;
extern int PriceConst=6;
extern double MaPeriod=5;
extern int MaMode=3;
extern double LevelsCross=0.95;
bool AlertOn=true;
extern int Countbars=300;
extern int ArrowUp=108;
extern int ArrowDn=108;
double signal_green;
double signal_red;
double ao;
double STV1;
double STV2;
double STV3;
double STV4;
int status=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  if (Volume[0]>1)
  return;

signal_green=iCustom(Symbol(),0,"Signal Line",
Signal_line_period,Signal_line_method,Signal_line_price,0,1);
signal_red=iCustom(Symbol(),0,"Signal Line",
Signal_line_period,Signal_line_method,Signal_line_price,2,1);
ao=iAO(Symbol(),0,1);

STV1=iCustom(Symbol(),0,"Trend Signal",FS30Range,FilterPeriod,MartFiltr,PriceConst,MaPeriod,MaMode,LevelsCross,Countbars,true,ArrowUp,ArrowDn,1,1);

STV2=iCustom(Symbol(),0,"Trend Signal",FS30Range,FilterPeriod,MartFiltr,PriceConst,MaPeriod,MaMode,LevelsCross,Countbars,true,ArrowUp,ArrowDn,2,1);

STV3=iCustom(Symbol(),0,"Trend Signal",FS30Range,FilterPeriod,MartFiltr,PriceConst,MaPeriod,MaMode,LevelsCross,Countbars,true,ArrowUp,ArrowDn,3,1);

STV4=iCustom(Symbol(),0,"Trend Signal",FS30Range,FilterPeriod,MartFiltr,PriceConst,MaPeriod,MaMode,LevelsCross,Countbars,true,ArrowUp,ArrowDn,4,1);


Comment("signal_green=",signal_green,
      "\nsignal_red=",signal_red,
         "\nAO=",ao,
         "\nSTV1=",STV1,
           "\nSTV2=",STV2,
             "\nSTV3=",STV3,
               "\nSTV4=",STV4);
 
  }
 

magic6666
16
magic6666  
it is my screen after run this EX
Files:
magic6666
16
magic6666  
and one other question , all indicators show their Data in Data window , how I can take data from Data window and don't use iCustom ? :-/
whroeder1
17063
whroeder1  
magic6666:

i tried use icustom in my ex but it don't give any data, i will be very thankful if you say me where is my wrong.

signal_green=iCustom(Symbol(),0,"Signal Line", Signal_line_period, Signal_line_method, Signal_line_price, 0, 1);

STV4=iCustom(Symbol(), 0, "Trend Signal", FS30Range, FilterPeriod, MartFiltr, PriceConst, MaPeriod, MaMode, LevelsCross, Countbars, true, ArrowUp, ArrowDn, 4, 1);

all indicators show their Data in Data window ,

how I can take data from Data window and don't use iCustom ? :-/

  1. How should we now wether your iCustom calls are correct when you don't provide either indicator's code? What is _LastError after each call?
  2. False assumption; have you looked at the code? The indicator can decide not to show buffer(s) in the data window, only on the chart.
    SetIndexLabel(0, NULL);
    And a indicator can show a buffer in the data window but not in the chart.
    #property indicator_color2 CLR_NONE

  3. You can't. Just get the value of the indicator into the EA and do what you want with it. It isn't hard. See Detailed explanation of iCustom - MQL4 forum
  4.  if (Volume[0]>1)
    For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 forum.) Always use time.

    I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
    New candle - MQL4 forum

  5. Please use
SRC
    Play video
    Please edit your post.
    For large amounts of code, attach it.
magic6666
16
magic6666  
It is that Indicator that I want use it in my EX.
Files:
magic6666
16
magic6666  

I didn't know it , I must have these Indicators just in Indicator folder and not in other sub folder , anyway thank you for your help :-)

To add comments, please log in or register