Download MetaTrader 5
To add comments, please log in or register
Have you developed a profitable strategy? Share it with millions of traders via Signals!
AYMERIC75
112
AYMERIC75 2014.08.12 12:20 

Hi everyone !


  I've tested my EA based on Ichimoku technic, it suppose to display an arrow up when Ichimoku indicates a Buy signal and an arrow down when it indicates a sell signal, but i see no arrow on the graph, just the Ichimoku curves (and i didn't asked my EA to show those...)


Here is my code, feel free to test it...


Cheers


Aymeric


//+------------------------------------------------------------------+
//|                                                         Ichi.mq4 |
//|                                                          AYMERIC |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "AYMERIC"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict


double Tenkan_value = iIchimoku(NULL, 0,9,26,52, MODE_TENKANSEN, 1);
double Kijun_value = iIchimoku(NULL,0,9,26,52, MODE_KIJUNSEN, 1);
double Chinkou_value =iIchimoku(NULL,0,9,26,52, MODE_CHINKOUSPAN, 1);
double senkouA=iIchimoku(NULL,0,9,26,52,3,1);
double senkouB=iIchimoku(NULL,0,9,26,52,4,1);

int count=0;



//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
int start()
{
  if (senkouA>=senkouB && Bid > senkouA && Chinkou_value> Bid)
  {
     if (Tenkan_value>=Kijun_value)
        {
         ObjectCreate(0,"fleche"+(string)count, NULL, OBJ_ARROW_BUY,0,Time[0], Bid);
        } 
  }
  else if (senkouA<=senkouB && Bid > senkouB && Chinkou_value> Bid)
  {
      if (Tenkan_value<=Kijun_value)
        {
         ObjectCreate(0,"fleche"+(string)count, NULL, OBJ_ARROW_SELL,0,Time[0], Bid);
        }
  
  }
  count ++;
     
return 0;
}
//+------------------------------------------------------------------+
Keith Watford
Moderator
7990
Keith Watford 2014.08.12 13:09  

Why is this global scope

double Tenkan_value = iIchimoku(NULL, 0,9,26,52, MODE_TENKANSEN, 1);
double Kijun_value = iIchimoku(NULL,0,9,26,52, MODE_KIJUNSEN, 1);
double Chinkou_value =iIchimoku(NULL,0,9,26,52, MODE_CHINKOUSPAN, 1);
double senkouA=iIchimoku(NULL,0,9,26,52,3,1);
double senkouB=iIchimoku(NULL,0,9,26,52,4,1);

 Surely it should be in start() ?

AYMERIC75
112
AYMERIC75 2014.08.12 14:23  
It has no effect if i put it in start() ....
qjol
3243
qjol 2014.08.12 14:35  
AYMERIC:
It has no effect if i put it in start() ....


that's what "you" think

i would really recommend you to read the book

or like WHRoeder says:

You have only three choices: Search for it, learn to code it, or pay someone  

Keith Watford
Moderator
7990
Keith Watford 2014.08.12 23:14  
GumRai:

Why is this global scope

 Surely it should be in start() ?

double Tenkan_value = iIchimoku(NULL, 0,9,26,52, MODE_TENKANSEN, 1);
double Kijun_value = iIchimoku(NULL,0,9,26,52, MODE_KIJUNSEN, 1);
double Chinkou_value =iIchimoku(NULL,0,9,26,52, MODE_CHINKOUSPAN, 1);
double senkouA=iIchimoku(NULL,0,9,26,52,3,1);
double senkouB=iIchimoku(NULL,0,9,26,52,4,1);

 


AYMERIC:
It has no effect if i put it in start() ....

  The problem is not that it has no effect in start()

  The problem is with

 

if (senkouA>=senkouB && Bid > senkouA && Chinkou_value> Bid)

// and

if (senkouA<=senkouB && Bid > senkouB && Chinkou_value> Bid)

 

 The ChinkouSpan value will always be zero for bar[1]

therefore it will never be > Bid

Note that you increment count every tick whether a new object is created or not.

Also, you do not delete the objects in deinit, that means that if you change timeframes, the objects from the first timeframe will remain on the chart.

whroeder1
13641
whroeder1 2014.08.13 02:12  
qjol:or like WHRoeder says: You have only three choices: Search for it, learn to code it, or pay someone
:)
AYMERIC75
112
AYMERIC75 2014.08.13 10:57  
GumRai:

  The problem is not that it has no effect in start()

  The problem is with

 

 

 The ChinkouSpan value will always be zero for bar[1]

therefore it will never be > Bid

Note that you increment count every tick whether a new object is created or not.

Also, you do not delete the objects in deinit, that means that if you change timeframes, the objects from the first timeframe will remain on the chart.


Thank you for this answer, but how would you solve the problem with the chikou value (because i need it in my EA)...
AYMERIC75
112
AYMERIC75 2014.08.13 12:28  

I replaced the 0 in the ChinkouSpan function by 26, but now the chikou value is the same as the Bid value... I really don't understand...


int start()
{

   double Chikou_value =iIchimoku(NULL,0,9,26,52, MODE_CHINKOUSPAN, 26);
   double senkouA=iIchimoku(NULL,0,9,26,52,3,1);
   double senkouB=iIchimoku(NULL,0,9,26,52,4,1);
   
   printf("valeur chikou  %e ",Chikou_value);
   printf("valeur  Bid  %e ",Bid);


     
return 0;
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.08.13 12:36  

If you ask this question means that you need to ask someone to fix it for you.

https://www.mql5.com/en/job

/
To add comments, please log in or register