| / | Forum |
|
firelake
2006.07.14 03:14
Stingo,
How would I know? You guys are experts in MQL4... That is why I attached indicator code, and if there is anything I should change in it, please let me know!!! How hard it could be to advise me on 5 lines indicator? And again, I am testing on Open prices only (not every tick) and do not see anything close to your printout. One line and one value per every 1H bar. |
5089 |
stringo
2006.07.14 11:25
I don't know exactly your algorithm but I have 2 remarks.
1. Counting from 0 to Bars is way from current (last) bar to oldest (first) bar i.e. reverse direction for(int i=0; i<limit; i++) { MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)]; MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)]; price = (High[i]+Low[i])/2; Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1; Value=MathMin(MathMax(Value,-0.999),0.999); ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1; Value1=Value; Fish1=ExtBuffer0[i]; } For example |
|
firelake
2006.07.15 06:00
Stingo,
thank you very much for your suggestions. I took a look into Bands.mq4, but not sure how it helps (I don't see anything helpful there). Ok, I think I finally can show you what is going on. Below is a picture taken from the terminal and strategy tester as well. Now, I am printing values starting from index 1, not 0! So, in Terminal window Curr is index 1, Prev is index 2 (circled with red), Curr_1 is index 3 and Prev_1 is index 4 (circled with blue) on MyInd. In the terminal printout, values are EXACTLY as they are on the chart when I do mouse hoover. I am using exactly the same indicator in Strategy Tester and last values in tester printout are correct (circled with red). However, next set of values (in blue) are wrong!!! Somehow, Tester does not calculate indicator values in the same way Terminal does. Modified MyInd.mq4 is attached for your reference. Any ideas? Thanks. ![]() sfgsf |
|
firelake
2006.07.15 06:03
sorry, forgot to attached MyInd.mq4, here it is.
|
|
jskillings
2006.09.06 07:48
I have seen the same problem firelake is having and would be very interested in
any answers. Thank you
|
5089 |
stringo
2006.09.06 11:33
firelake, see updated indicator
//+------------------------------------------------------------------+ //| MyInd.mq4 | //| | //+------------------------------------------------------------------+ #property copyright "" #property link "szm@pictaa.com" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Blue extern int period=10; double ExtBuffer0[]; double Value1; double Fish1; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_LINE); IndicatorDigits(Digits+1); SetIndexBuffer(0,ExtBuffer0); IndicatorShortName("MyInd"); Value1=0; return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i,limit; int counted_bars=IndicatorCounted(); double prev,prev1,current,old; double Value=0,Value2=0,Fish=0,Fish2=0; double price; double MinL=0; double MaxH=0; i=Bars-period+1; if(counted_bars>period-1) i=Bars-counted_bars-1; while(i>=0) { MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)]; MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)]; price = (High[i]+Low[i])/2; Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1; Value=MathMin(MathMax(Value,-0.999),0.999); ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1; Value1=Value; Fish1=ExtBuffer0[i]; i--; } Print("IND: [1]=",ExtBuffer0[1],"; [2]=",ExtBuffer0[2],"; [3]=",ExtBuffer0[3],"; [4]=",ExtBuffer0[4]); return(0); } //+------------------------------------------------------------------+
|