Tâche terminée
Spécifications
Hi
I have added the Ichimoku Indicator into my EA (MQL5) and I want to use the cloud values to indicate entry conditions, (or not to enter) based on the position of the cloud.
I am having an issue. When I retrieve the value of the SENKOUSPAN A LINE, I am getting a number such as 30, 35 or 40 etc. I am not getting the actual underlying price value e.g. 1.08995.
I would have expected to be getting the price value. I have done much research to find out how I can get the price value at the SENKOUSPAN A LINE and I still haven't been able to resolve. I am very keen for someone to offer your expert advice in this and tell me what I am doing wrong.
Here is the code I wrote to retrieve the value for SENKOUSPAN A LINE. Please note, than visually on my screen, if I hover over the SENKOUSPAN A LINE, I can see the price value I am after. I just cant seem to retrieve this problematically in MQL5.
//---------------------------------------------------------------------
// ReGetIchimokuValues
//---------------------------------------------------------------------
//---------------------------------------------------------------------
string MyTrend::ReGetIchimokuValues(int Indicator_Handle=INVALID_HANDLE)
{
//The buffer numbers: 0 - TENKANSEN_LINE, 1 - KIJUNSEN_LINE, 2 - SENKOUSPANA_LINE, 3 - SENKOUSPANB_LINE, 4 - CHIKOUSPAN_LINE.
double iTENKANSEN_LINE_Buffer[];
double iKIJUNSEN_LINE_Buffer[];
double iSENKOUSPANA_LINE_Buffer[];
double iSENKOUSPANB_LINE_Buffer[];
double iCHIKOUSPAN_LINE_Buffer[];
string s = "";
ArraySetAsSeries(iTENKANSEN_LINE_Buffer,true);
ArraySetAsSeries(iKIJUNSEN_LINE_Buffer,true);
ArraySetAsSeries(iSENKOUSPANA_LINE_Buffer,true);
ArraySetAsSeries(iSENKOUSPANB_LINE_Buffer,true);
ArraySetAsSeries(iCHIKOUSPAN_LINE_Buffer,true);
CopyBuffer(Indicator_Handle,0,0,3,iTENKANSEN_LINE_Buffer); //0 - TENKANSEN_LINE
CopyBuffer(Indicator_Handle,1,0,3,iKIJUNSEN_LINE_Buffer); //1 - KIJUNSEN_LINE
CopyBuffer(Indicator_Handle,2,0,3,iSENKOUSPANA_LINE_Buffer); //2 - SENKOUSPANA_LINE
CopyBuffer(Indicator_Handle,3,0,3,iSENKOUSPANB_LINE_Buffer); //3 - SENKOUSPANB_LINE
CopyBuffer(Indicator_Handle,4,0,3,iCHIKOUSPAN_LINE_Buffer); //4 - CHIKOUSPAN_LINE
//https://www.mql5.com/en/forum/172986
//This indicator is based on the 4 time intervals and because of that we may see the 5 different line:
//- Tenkan-sen is the average value of the price for the first time interval calculated as sum of maximum and minimum for this period of time devided by 2;
//- Kijun-sen is the average value of the price for the second time interval;
//- Senkou Span A is the middle of interval between two above mentioned lines (Tenkan-sen and Kijun-sen) shifted onward on the value of the second time interval;
//- Senkou Span B is the average value of the price for the third time interval shifted onward on the value of the second time interval;
//- Chinkou Span is the closing price of the current candle shifted back on the value of the second time interval.
TENKANSEN_LINE_Value = NormalizeDouble(iTENKANSEN_LINE_Buffer[0],5);
KIJUNSEN_LINE_Value = NormalizeDouble(iKIJUNSEN_LINE_Buffer[0],5);
SENKOUSPANA_LINE_Value = NormalizeDouble(iSENKOUSPANA_LINE_Buffer[0],5);
SENKOUSPANB_LINE_Value = NormalizeDouble(iSENKOUSPANB_LINE_Buffer[0],5);
CHIKOUSPAN_LINE_Value = NormalizeDouble(iCHIKOUSPAN_LINE_Buffer[0],5);
s = "TENKANSEN_LINE=" + (string)TENKANSEN_LINE_Value + " | KIJUNSEN_LINE=" + (string)KIJUNSEN_LINE_Value + " | SENKOUSPANA_LINE=" + (string)SENKOUSPANA_LINE_Value + " | SENKOUSPANB_LINE=" + (string)SENKOUSPANB_LINE_Value + " | CHIKOUSPAN_LINE=" + (string)CHIKOUSPAN_LINE_Value;
return(s);
}