[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: AFL Studies



PureBytes Links

Trading Reference Links



here is something that might get you started:
select your points using left mouse button , clear all using middle mouse button.

SetBarsRequired( -2, -2 );
bi =
BarIndex();
bis =
SelectedValue( bi );

symbol =
Name();
tframe =
Interval();
chartID =
GetChartID();
Xname =
"X" + chartID + symbol + tframe;
Yname =
"Y" + chartID + symbol + tframe;

LeftButton =
GetCursorMouseButtons() & 8;
a =
Nz(StaticVarGet("counter"));
if ( leftButton )
{

    x =
GetCursorXPosition(  );
    y =
GetCursorYPosition(  );
    
StaticVarSet( Xname + bis, x );
    
StaticVarSet( Yname + bis, y );
   
StaticVarSet("counter", a+1);
}


j =
0;
dt =
DateTime();
shapePlot =
0;
shapePos =
Null;
xx = yy =
Null;
for ( i = 0; i <BarCount; i++ )
{

    x =
StaticVarGet( Xname + i );
    y =
StaticVarGet( Yname + i );

    
if ( x == dt[i] )
    {
   

        shapePlot[i] =
1;
        shapePos[i] = y;
        xx[j] = i;
        yy[j] = y;
        j++;
    }

}

shape =
shapeSmallCircle;
PlotShapes( shapePlot*shape, colorRed, 0, shapePos, 0 );

for ( i = 1; i < j; i++ )
{
      
  
Plot( LineArray( xx[i-1], yy[i-1],  xx[i], yy[i] ), "", colorRed, styleThick );
}



if ( GetCursorMouseButtons() == 12 )
{
   
    
for ( i = 0; i < BarCount; i++ )
    {
        
StaticVarRemove("counter");
        
StaticVarRemove( Xname + i );
        
StaticVarRemove( Yname + i );
      
    }

}

RequestTimedRefresh( 1 );

Plot( C, "", colorWhite, styleBar, 0, 0, 0 );
Title = "mouseButtons returns: " + (GetCursorMouseButtons()) +  "\nclick counter: " + StaticVarGet("counter");



af_1000000 wrote:
Sorry, I reposed it. The previous one was hardly readable.

Thanks for a prompt replay. Sorry TJ, but your response is a semi-constructive one. I mentioned in my original posting that I do NOT want to use GFX functionality for several reasons:

1. It would be nice to save AFL study the same way as any other studies for future references (if I shut down AB and open it again tomorrow or the day after tomorrow the study still should be available - the anchor points never change unless they are adjusted by the user).
2. If points anchors: A,B,C (mentioned in the original example) are off the chart tomorrow (e.g. intra chart) , but still within loaded bars I should be able to see the result of the study. For that reason I would use LineArray()to plot any lines or other polygon type shapes.

It seems that the project is doable. To accomplish the task the script would have to:

1. Collect three mouse clicks (waiting every time for a chart refresh - quite a difference from collecting values for other parameters).
2. Store click coordinates in the external file (ASCII) for future references using some kind of naming convention, so the file could be found later on.
3. Every time a symbol is selected the script would have to check if there are any studies (external files) available with the number of coordinates required (equal to number of clicks handled by this particular script). If studies are not available should it wait to gather them ??? (even if studies for that symbol are not needed). Well, the problem with templates, Chart_Ids is another story better left for future considerations.

It should be obvious that the method described above is quite primitive and rather rude. I hope that I am wrong and something better exists.
Logically, AFL study should not differ from any other PARAM function. PARAM functions accept values from users (either entry or selection from the list) and remember them for any current or future executions).
What is the difference between Length = Param("Len", 5) which stores the length equal to 5 and e.g. Clicks = ParamClick(3) ? (which could gather three mouse clicks and store cliks coordinates) . To get individual coordinates: e.g. Click_1_X = GetX(Clicks[ 1]),Click_ 1_Y = GetY(Clicks[ 1]), ... and so on. It is up to the script to interpret parameter values as long as they are available.

I realize that such functionality does not exist in AB, but maybe there is something better than I described earlier ?

AF



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

  


__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___