Hi,
Wish to inform the following problem when using the Ichimoku indicator:
a) Senkou Span A & Span B's values diplayed on the small Data Window are not correct after verifying with the formula and checked with the bar data on the chart;
b) Accessing the buffers of Ichimoku Senkou Span A & Span B using create CreateIndicator and GetIndicator returned two values different from the Data Window (using BufferIndex 3 and 4) :
-----------------------------------
procedure ResetStrategy; stdcall;
begin
OrderHandle := -1;
IndIchimoku := CreateIndicator(Currency, TimeFrame, 'Ishimoku',
Format('%d;%d;%d', [TenkanSenPeriod, KijunSenPeriod, SenkouSpanBPeriod]));
end;
procedure GetSingleTick; stdcall;
var
.......
SenkouSpanA := GetIndicatorValue(IndIchimoku,0,3);
SenkouSpanB := GetIndicatorValue(IndIchimoku,0,4);
------------------------------------
Tenkan Sen and Kijun Sen's values fetched from GetIndicatorValue are correct and tally with the one in the Data Window.
Thanks.
Ichimoku error
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
-
- Posts: 3
- Joined: Thu Oct 27, 2011 11:50 am
Ichimoku error
Hi,
Item (1):
My appology for the mistake made in item (1)- as I had inserted 25 instead of 26 into the ihighest and ilowest functions to calculate Senkou Span A & SpanB.
For time shifting of 26 period, I should use 26 and not 25 as the initial bar.
Formula used:
F_SenkouSpanB := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 52, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 52, 26)))/2;
Item (2) - Span A & Span B values returned from GetIndicatorValue is different from the data window. Part of the related codes:
procedure GetSingleTick; stdcall;
var
//B_...denotes value fetched from buffer
B_TenkanSen: double;
B_KijunSen: double;
B_SenkouSpanA: double;
B_SenkouSpanB: double;
//F_ calculated values
F_TenkanSen: double;
F_KijunSen: double;
F_SenkouSpanA: double;
F_SenkouSpanB: double;
......
.....
//method 1: accessing bufffers
B_TenkanSen := GetIndicatorValue(IndIchimoku,0,0);//correct
B_KijunSen := GetIndicatorValue(IndIchimoku,0,1);//correct
B_SenkouSpanA := GetIndicatorValue(IndIchimoku,0,3);//wrong value
B_SenkouSpanB := GetIndicatorValue(IndIchimoku,0,4);//wrong value
}
//method 2: by formula
F_TenkanSen := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 9, 0)) + low(iLowest(Currency, timeFrame, MODE_LOW, 9, 0)))/2;
F_KijunSen := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 26, 0)) + low(iLowest(Currency, timeFrame, MODE_LOW, 26, 0)))/2;
F_SenkouSpanA := ((high(iHighest(Currency, TimeFrame, MODE_HIGH, 9, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 9, 26)))/4) + ((high(iHighest(Currency, TimeFrame, MODE_HIGH, 26, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 26, 26)))/4);
F_SenkouSpanB := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 52, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 52, 26)))/2;
//include the str and print to compare the values displayed in the jounal while executing an instant sell order
str(B_TenkanSen, val);
Print('B_Tenkan ' + val);
str(B_KijunSen, val);
Print('B_Kijun ' + val);
str(B_SenkouSpanA, val);
Print('B_spanA ' + val);
str(B_SenkouSpanB, val);
Print('B_spanB ' + val);
str(F_TenkanSen, val);
Print('F_Tenkan ' + val);
str(F_KijunSen, val);
Print('F_Kijun ' + val);
str(F_SenkouSpanA, val);
Print('F_spanA ' + val);
str(F_SenkouSpanB, val);
Print('F_spanB ' + val);
After running the strategy and refer to the last "sell" trade as example, using the jounal to compare these values:
- Calculated values = values in data window, for all four values.
- Buffer values of Senkou Span A and Span B is different from the data windows.
I have attached the image and the strategy files for your reference.
Thanks.
Item (1):
My appology for the mistake made in item (1)- as I had inserted 25 instead of 26 into the ihighest and ilowest functions to calculate Senkou Span A & SpanB.
For time shifting of 26 period, I should use 26 and not 25 as the initial bar.
Formula used:
F_SenkouSpanB := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 52, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 52, 26)))/2;
Item (2) - Span A & Span B values returned from GetIndicatorValue is different from the data window. Part of the related codes:
procedure GetSingleTick; stdcall;
var
//B_...denotes value fetched from buffer
B_TenkanSen: double;
B_KijunSen: double;
B_SenkouSpanA: double;
B_SenkouSpanB: double;
//F_ calculated values
F_TenkanSen: double;
F_KijunSen: double;
F_SenkouSpanA: double;
F_SenkouSpanB: double;
......
.....
//method 1: accessing bufffers
B_TenkanSen := GetIndicatorValue(IndIchimoku,0,0);//correct
B_KijunSen := GetIndicatorValue(IndIchimoku,0,1);//correct
B_SenkouSpanA := GetIndicatorValue(IndIchimoku,0,3);//wrong value
B_SenkouSpanB := GetIndicatorValue(IndIchimoku,0,4);//wrong value
}
//method 2: by formula
F_TenkanSen := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 9, 0)) + low(iLowest(Currency, timeFrame, MODE_LOW, 9, 0)))/2;
F_KijunSen := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 26, 0)) + low(iLowest(Currency, timeFrame, MODE_LOW, 26, 0)))/2;
F_SenkouSpanA := ((high(iHighest(Currency, TimeFrame, MODE_HIGH, 9, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 9, 26)))/4) + ((high(iHighest(Currency, TimeFrame, MODE_HIGH, 26, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 26, 26)))/4);
F_SenkouSpanB := (high(iHighest(Currency, TimeFrame, MODE_HIGH, 52, 26)) + low(iLowest(Currency, timeFrame, MODE_LOW, 52, 26)))/2;
//include the str and print to compare the values displayed in the jounal while executing an instant sell order
str(B_TenkanSen, val);
Print('B_Tenkan ' + val);
str(B_KijunSen, val);
Print('B_Kijun ' + val);
str(B_SenkouSpanA, val);
Print('B_spanA ' + val);
str(B_SenkouSpanB, val);
Print('B_spanB ' + val);
str(F_TenkanSen, val);
Print('F_Tenkan ' + val);
str(F_KijunSen, val);
Print('F_Kijun ' + val);
str(F_SenkouSpanA, val);
Print('F_spanA ' + val);
str(F_SenkouSpanB, val);
Print('F_spanB ' + val);
After running the strategy and refer to the last "sell" trade as example, using the jounal to compare these values:
- Calculated values = values in data window, for all four values.
- Buffer values of Senkou Span A and Span B is different from the data windows.
I have attached the image and the strategy files for your reference.
Thanks.
- Attachments
-
- Ichimoku.JPG (181.24 KiB) Viewed 28233 times
-
- Posts: 3
- Joined: Thu Oct 27, 2011 11:50 am
Ichimoku error
HI,
Strategy file attached.
Thanks.
Strategy file attached.
Thanks.
Who is online
Users browsing this forum: No registered users and 16 guests