StartY and EndY with extension in Exploration

Hello

my AB version 6.20.1 Pro (64bits)

I draw a rectangle study on a graph with right and/or left extensions
In an AFL exploration , I want to check if Close is above, under or in the rectangle study zone
So I need to have StartY and EndY of this study
No issue without right/left extension (unchecked)
But if right and/or left extensions are checked then StartY and/or EndY are wrong in the Exploration result

I don't know how to have correct values of StartY and EndY with extensions checked ???

re = Study("RE", 1215 );
Filter = Status("lastbarinrange");
AddTextColumn(FullName(),"Nom",1,colorBlack);
AddColumn(C,"Close",1.3,IIf(Highest(H)==H,colorGreen,IIf(Lowest(L)==L,colorRed,colorBlack)));
AddColumn(ROC(C,1,True),"%",1.2,IIf(ROC(C,1,True)>0,colorGreen,ColorRed));
AddColumn(ValueWhen( ExRem( re, 0 ), BarIndex() ),"StartX",1.0);  // if left extend StartX=0
AddColumn(ValueWhen( re, BarIndex()),"EndX",1.0);  // if rignt extend EndX=Barcount
AddColumn(ValueWhen( ExRem( re, 0 ), DateTime() ),"StartX",formatDateTime);
AddColumn(ValueWhen( re, DateTime()),"EndX",formatDateTime);

AddColumn(ValueWhen( ExRem( re, 0 ), re ),"startY",1.3);   //  without Left Extend
AddColumn(ValueWhen( re, re),"endY",1.3);   //  without Right Extend

SetSortColumns(2);

Thanks for your help
Best regards

Without Right/Left Extension : OK

properties_without
exploration_without

With Right/Left Extension : KO
exploration_with
properties_with

Hi,

It is been answered already , i guess ,

Check the below post

https://forum.amibroker.com/t/study-values-change-unexpectedly/15410/3?u=kaeswar

Hello @kaeswar

Yes I read it before post my topic, but anyway I recheck it according your suggestion

The post talks about

Status("QuickAFLFirstDataBar") which is equal 0 with left extend
Status("QuickAFLLastsDataBar") which is equal Barcount-1 with right extend

It's useless in my case, I need to retreive StartY and EndY
StartX and EndX are correct with (or without) right/left extension in the study and I don't really need them, I put them in my exploration just for checking

And the post talks about, in the link about QuickAFL, the function SetBarsRequired which is according the documentation :

"set number of previous and future bars needed for script/DLL to properly execute. If your formula is pure AFL you don't need to use this function at all, as AmiBroker automatically calculates number of bars required for all its built-in functions."

My exploration is a pure AFL, and I have an issue ONLY in exploration result, not on the graph, the rectangle study have the correct StartY and EndY from 0 to Barcount-1, the rectangle study stays a rectangle :slight_smile:

Anyway I tried to add it in the exploration formula and in a new graph, nothing change :frowning:

Or maybe I understand anything, this is possible too :wink:

Thanks anyway for your suggestion, if you have any other idea, please don't hesitate, I'm stuck :frowning:

Best regards

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.