Using mouse button clicks to set pivots for Fibonacci retracements / extensions

Hi all,

I have no formal programming experience.

I am trying to write a formula for Fib. price and time analysis using multiple pivots, without any lines being drawn on the price bars. [ using the inbuilt studies creates numerous horizontal (price studies] and vertical
lines [time studies] on the price chart.

Below is an AFL for plotting Fib price retracements and external extensions / projections in the RHS clear area of a chart using the range markers (vertical lines --green-start and red -end) to select the start and end value.
Using range markers the retracements can only be drawn once.

My current path is to use "click" of mouse buttons to select the high and low values for drawing the fib.
price retracements and projections. Been struggling and no success. When I use the right mouse button
the drop down menu (parameters ---------close) opens on the chart.

Can some AFL expert please guide me how to plot fib price rets. from multiple pivots, ie more than once !

Further an AFL drawing "extensions" [3 pivots require to be selected] .

I have struggled with using mouse button clicks , have had no success, therefore asking for help !

Thanks.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
TC = IIf(C > Ref(C,-1),colorGreen , colorRed);
Plot( C, "Close", TC, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );  
_SECTION_END();


_SECTION_BEGIN("FIBS");
/*---------------------------------------------------
	Another Fib Level
	Based on Aron Pipa's formula , December, 11, 2005
	
   * Under Parameters, select "axis & Grid" , 
     "show date axis" = "yes"
	* Dash lines are the fib extentions
	* If you are not familiar with begin/end values double 
	click a lot around the screen til you get the idea 
	* Select your fib retrace in a higher timeframe e.g. 
	daily and view chart in e.g. 5 min, to see magor 
	retracement  lines.
--------------------------------------------------------*/

EnableTextOutput(0);

// Get values for fib levels 

// Get values for fib levels 
StartBar=BeginValue(BarIndex());
EndBar = EndValue( BarIndex() ); 
LastBar=BarCount-1;
period = EndBar - StartBar;
Lo =LLV(L,period);
Hi = HHV(H,period);
HiEnd = EndValue(H);
HiStart =  BeginValue(H);

Line0 = IIf(HiEnd >HiStart , EndValue(H),EndValue(L));
Line100 = IIf(  HiEnd <HiStart , BeginValue(H), BeginValue(L));
Line1 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.236, Line100 - abs(Line100-Line0)*0.236);
Line2 =IIf(HiEnd >HiStart, Line0 -abs(Line100-Line0)*0.382, Line100 - abs(Line100-Line0)*0.382);
Line3 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.5, Line100 - abs(Line100-Line0)*0.5);
Line4 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.618, Line100 - abs(Line100-Line0)*0.618);
Line5 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.786, Line100 - abs(Line100-Line0)*0.786);


//EXTENSIONS
Line1DZ = IIf(HiEnd >HiStart, Line100 - abs(Line100-Line0)*0.128, Line100 + abs(Line100-Line0)*0.128);
Line2DZ = IIf(HiEnd >HiStart, Line100- abs(Line100-Line0)*0.272, Line100 + abs(Line100-Line0)*0.272);
LineGR = IIf(HiEnd >HiStart, Line100 - abs(Line100-Line0)*0.618, Line100 + abs(Line100-Line0)*0.618);


// Plot
plotfibRET = ParamToggle(  "PLOT FIB RET","OFF|ON",0);
if(plotfibRET)
{
GfxSetZOrder( 5 );
GfxSetCoordsMode( 1 );

GfxSelectPen(colorPink,1,1);
GfxMoveTo(EndBar,Line100);
GfxLineTo(LastBar+1,Line100);
GfxSelectPen(colorPink,2,0);
GfxMoveTo(LastBar+1,Line100);
GfxLineTo(LastBar+10,Line100);

GfxSelectPen(colorPink,1,1);
GfxMoveTo(startBar,Line0);
GfxLineTo(LastBar+1,Line0);
GfxSelectPen(colorPink,2,0);
GfxMoveTo(LastBar+1,Line0);
GfxLineTo(LastBar+10,Line0);

GfxSelectPen(colorPaleBlue,2,0);
GfxMoveTo(LastBar+1,Line1);
GfxLineTo(LastBar+10,Line1);

GfxSelectPen(colorBrightGreen,2,0);
GfxMoveTo(LastBar+1,Line2);
GfxLineTo(LastBar+10,Line2);

GfxSelectPen(colorRed,2,0);
GfxMoveTo(LastBar+1,Line3);
GfxLineTo(LastBar+10,Line3);

GfxSelectPen(colorBlue,2,0);
GfxMoveTo(LastBar+1,Line4);
GfxLineTo(LastBar+10,Line4);


GfxSelectPen(colorGrey40,2,0);
GfxMoveTo(LastBar+1,Line5);
GfxLineTo(LastBar+10,Line5);
PlotText( "100% = "+Line100, BarCount+10,line100  ,colorPink) ;
PlotText( "0% = "+Line0, BarCount+10, line0  ,colorPink) ;
PlotText( "78.6%RET = "+Line5, BarCount+10,line5  ,colorGrey40) ;
PlotText( "61.8%RET = "+Line4, BarCount+10,line4  ,colorBlue) ;
PlotText( "50%RET ="+Line3, BarCount+10,line3  ,colorRed) ;
PlotText( "38.2% RET= "+Line2, BarCount+10,line2  ,colorBrightGreen) ;
PlotText( "23.6% RET= "+Line1, BarCount+10,line1 ,colorPaleBlue) ;
}
// SHOW EXTENSIONS
SHOWEXT = ParamToggle("SHOW EXTENSIONS","OFF|ON",0);

if(SHOWEXT)
{
GfxSelectPen(colorBlue,2,0);
GfxMoveTo(LastBar+1,Line1DZ);
GfxLineTo(LastBar+10,Line1DZ);



GfxSelectPen(colorBlue,2,0);
GfxMoveTo(LastBar+1,Line2DZ);
GfxLineTo(LastBar+10,Line2DZ);



GfxSelectPen(colorGold,2,0);
GfxMoveTo(LastBar+1,LineGR);
GfxLineTo(LastBar+10,LineGR);

PlotText( "121.8% EXT= "+Line1DZ, BarCount+10,line1DZ ,colorBlue) ;
PlotText( "127.2% EXT= "+Line2DZ, BarCount+10,line2DZ ,colorBlue) ;
PlotText( "161.8% EXT= "+LineGR, BarCount+10,lineGR ,colorGold) ;
}





// Title
/*
Title=    StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )+"\n Automatic Fib Levels  "+"\n"+"\n"+


EncodeColor( colorGold )  + "  161.8%  =  "+LineGR +"  " +"\n"+
EncodeColor( colorBlue )  + "  127.2%  =  "+Line2DZ +"  " +"\n"+
EncodeColor( colorBlue)  + "  112.8%  =  "+Line1DZ +"  " +"\n"+

EncodeColor( colorPink )  + "  100%  =  "+Line100 +"  " +"\n"+
EncodeColor( colorGrey40 )  + " 78.6%  =  "+EncodeColor( colorGrey40 )+Line5 +"  "+"\n"+
EncodeColor( colorBlue)  + " 61.8%  =  "+EncodeColor( colorBlue )+Line4   +"  "+"\n"+
EncodeColor( colorRed )  + " 50.0%  =  "+EncodeColor( colorRed )+Line3   +"  "
+"\n"+
EncodeColor( colorBrightGreen)   + " 38.2%  =  "+EncodeColor( colorBrightGreen )+Line2   +"  "
+"\n"+
EncodeColor( colorPaleBlue)    + " 23.6%  =  "+EncodeColor( colorPaleBlue )+Line1   +"  "
+"\n"+
EncodeColor( colorPink )  + "     0%   =  "+Line0;
_SECTION_END(  );


1 Like

Hi,
Me again,

Another thought - instead of using the 3 buttons(left, right and middle) for selecting 3 pivots --- CAN 3 CLICKS OF THE LEFT BUTTON be used for selecting the 3 pivots ?

image

Hi,

I am continuing under the heading of "using mouse button clicks" because that is where I am stuck !

Below is a code snippet for plotting a horizontal line + value(price) of the high or low of a bar using the
mouse left button click.

The plot does happen but disappears after a few seconds.

Can some one help me with the coding so that the plot stays on unless deleted. Further multiple plots should be possible.

I am sure that this can be done, after all multiple horizontal and vertical lines can be plotted with a single
click of the left mouse button, then the selected line can also be deleted.


////// USING LEFT MOUSE BUTTON "CLICK"TO DRAW A HORIZONTAL LINE  AND DISPLAY VALUE OF SELECTED HIGH OR LOW 

_SECTION_BEGIN("MLB CLICK");


GfxSetCoordsMode( 1 );
GfxSetOverlayMode(  0 ) ;
// MLB  click
plottag = ParamToggle("H-L Tag", " OFF | ON",0);
MLBClicked = GetCursorMouseButtons() == 9;

    MouseX = Nz( GetCursorXPosition( 1 ) );
    MouseY = Nz( GetCursorYPosition( 0 ) );
    

  
selectBi = SelectedValue( BarIndex() );
selectH = SelectedValue( H );
selectL = SelectedValue( L );

    CursoraboveH = MouseY> selectH ;
    
    CursorbelowL = MouseY < SelectL;
    
    
  if( plottag )
  {
if (  CursoraboveH  AND MLBClicked)
    { 
    
GfxSelectPen( colorGreen, 1, 2 );
GfxMoveTo( selectBi, selectH  );
GfxLineTo( BarCount+2, selectH );
 PlotText( "H = "+H, BarCount+3,selectH  ,colorGreen) ; 
    }
if (  CursorbelowL AND MLBClicked )
{
   
GfxSelectPen( colorRed, 1, 2 );
GfxMoveTo( selectBi, selectL  );
GfxLineTo( BarCount+2, selectL );
PlotText( "L = "+L, BarCount+3,selectL  ,colorRed) ;
}}

_SECTION_END();



@JEETU,

StaticVariables can be used to register three clicks or as many number of clicks you want, for that you will need to understand the example shown here - Moving GFX Objects. The example shows effect upon first click and then the next (so two clicks) on the basis of the Boolean value of MoveInProgress variable.

But "Fibonacci retracement" is already a part of AB's Study Tools and using its "Properties" you can customize any which way you want it. I think don't you need a separate code for this. Its explained in the guide - Study drawing tools.

Its not clear from your above posts what additional feature you want to incorporate into your "Fib retraces".

1 Like

Here is an example of the code detecting a double click:

It can be modified to recognize three clicks, but for the reasons mentioned by @Lennon I wouldnt go this way :wink:

1 Like

Yes Milosz I remember your efficient Ctrl+Click technique rather than chasing clicks. :grin:

// Ctrl+Click learned from Milosz's version: https://forum.amibroker.com/t/eadem-mutata-resurgo-logarithmic-spiral-in-amibroker-fibonacci-elliott-fischer/5764/11?u=lennon

SetChartOptions( 0, chartShowDates );
Title = " Ctrl + Left Mouse Button --> START,   Ctrl + Middle Mouse Button --> CLEAR";
chExt = ParamToggle( "Extend?", "No|Yes", 0 );

lvb = Status( "lastvisiblebar" );
ChId = GetChartID();

bi = BarIndex();
lvb = Status( "lastvisiblebar" );
fvb = Status( "firstvisiblebar" );
pxchartheight = Status( "pxchartheight" ); 
pxchartwidth = Status( "pxchartwidth" );
pxchartleft = Status( "pxchartleft" );
pxchartbottom = Status( "pxchartbottom" );
MinY = Status( "axisminy" );
MaxY = Status( "axismaxy" );

function ConvertBarToPixelX( bar )
{
     local bardiff, barnum, relbar, px;
     // Based on http://www.amibroker.com/kb/2009/03/30/how-to-convert-from-bar-value-to-pixel-co-ordinates/
     // Modified by fxshrat
     barnum = lvb - fvb + 1;
     bardiff = bar - fvb;
	 relbar = bardiff / barnum;
	 px = relbar * pxchartwidth + pxchartleft;
     return Nz( px );
}
function ConvertValueToPixelY( Value )
{
     // Based on http://www.amibroker.com/kb/2009/03/30/how-to-convert-from-bar-value-to-pixel-co-ordinates/
     // Modified by fxshrat
     pxy = pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight / ( Maxy - Miny + 1e-9 ) );
     return Nz( pxy );
}

MouseButtonPressed = GetCursorMouseButtons();
CtrlPressed =  GetAsyncKeyState( 17 ) < 0 ;
x = GetCursorXPosition( 0 );
y = GetCursorYPosition( 0 );

if( CtrlPressed )
{
	 x = LastValue( ValueWhen( x == DateTime(), bi ) );

	 if( MouseButtonPressed & 8 ) // Center point coordinates
	 {
		 StaticVarSet( "x1" + ChId, x );
		 StaticVarSet( "y1" + ChId, y );
	 }

	 if( MouseButtonPressed & 9 ) // Start point coordinates
	 {
		 StaticVarSet( "x2" + ChId, x ) + ChId;
		 StaticVarSet( "y2" + ChId, y ) + ChId;
	 }

	 if( MouseButtonPressed & 4 ) // Reset spiral pattern
	 {
		 StaticVarSet( "x1" + ChId, 0 );
		 StaticVarSet( "y1" + ChId, 0 );
		 StaticVarSet( "x2" + ChId, 0 );
		 StaticVarSet( "y2" + ChId, 0 );
	 }

	 RequestMouseMoveRefresh();
 }
 
Plot( C, "", colorDefault, styleCandle, Null, Null, 0, 0, 1 );

// Point A
P1X = ConvertBarToPixelX( StaticVarGet( "x1" + ChId ) );
P1Y = ConvertValueToPixelY( StaticVarGet( "y1" + ChId ) );
GfxSetTextColor( colorLightGrey );
GfxCircle( P1X, P1Y, 4 );
// Point B
P2X = ConvertBarToPixelX( StaticVarGet( "x2" + ChId ) );
P2Y = ConvertValueToPixelY( StaticVarGet( "y2" + ChId ) );
GfxCircle( P2X, P2Y, 4 );

GfxSelectPen( colorLightGrey, 1, 1 );
GfxMoveTo( P1X, P1Y );
GfxLineTo( P2X, P2Y );

// Drawing Golden-ratio line at 61.8%
if( StaticVarGet( "y2" + ChId ) > StaticVarGet( "y1" + ChId ) )
{
	 ValGR = StaticVarGet( "y2" + ChId ) - ( ( StaticVarGet( "y2" + ChId ) - StaticVarGet( "y1" + ChId ) ) * 0.618 );
}
else
{
	 ValGR = StaticVarGet( "y2" + ChId ) + ( ( StaticVarGet( "y1" + ChId ) - StaticVarGet( "y2" + ChId ) ) * 0.618 );
}

pxValGR = ConvertValueToPixelY( ValGR );
GfxSelectPen( colorRose, 1 );
GfxMoveTo( P1X, pxValGR );
if( chExt )
{
	 GfxLineTo( ConvertBarToPixelX( lvb ), pxValGR );
}
else
{
	 GfxLineTo( ConvertBarToPixelX( Barcount - 1 ), pxValGR );
}
2 Likes

Hi,

Thanks for the guidance, will give it a go and if I do not succeed I

hI,

CLICKED REPLY BY MISTAKE.
Once again thanks for the guidance, if I do not succeed will have to ask for assistance again.
I am well aware of the Fib price (ext. and ret.) and fib time drawing studies inbuilt into Amibroker.

The issue is that when one does price and time studies from multiple pivots the chart is covered with
many horizontal and vertical lines - really messy,

I am trying to draw all the fib. price studies in the RHS (blank) 0f the chart and if I succeed I will further
venture to do the same for the time studies, small vertical lines above and below the price chart - so the
price chart is "clean".

While going thru the AFL library did notice some one had put in a request a few "years" ago - no one followed up.

Once again thanks for ur help.

Hi,

I keep being told to use the fib price and time tools in Amibroker.

Just to clarify what I am trying to acheive, posting 2 charts
below - hope that provides an answer as to why I am trying to write an AFL for Fib price and time studies!

image

image

1 Like

Hi @JEETU

Hmmm
Now looks little bit better what you trying to achieve.
I can see a highlight box in area between 112.8 up to 127.2
But the yellow area?
For me Is not very clear your final Project.

1 Like

Hi PanoS,

The horizontal rectangles (blue outline with light blue fill and lime outline and yellow fill) are based on the fib price analysis on the "messy chart" and the small violet vertical rectangle and small violet vertical line are based on time analysis on the "messy chart".

The logic of the blue rectangles is from another software (MTPredicftor) I use and the concept of the rectangles with lime outline and yellow fill is for "Fib. clusters" .

The fib cluster and fib time analysis is based on a book called "High Probability Trading strategies"
by Robert C. Miner(dynamictraders.com) and a book called "Fibonacci Trader" by Calroln Boroden(fibonacciqueen.com).

With the amazing capability of AFL I am sure that I can obtain the same results without messing up the chart.

Draw back is that apart from my limited experience with AFL I have no programming experience.

To keep it simple and for a start :--- In Amibroker from the drawing tools I can draw multiple horizontal and vertical lines on a chart, then delete any line by selecting and pressing "delete" on the key board - the question is "WHAT IS THE AFL FOR THAT".

Even if the issue of drawing Hi Lo tags (one of my above posts) with the click of a mouse button is solved it will be a major breakthrough --- but I am still stuggling.

The above two suggestions are for shifting a drawn object using click of a mouse button WHEREAS I want to draw using the click of a mouse button.

One can only try and hope for help!

1 Like

what about if you DONOT using mouse clicks?
can you check this version here just for the idea (it is old AFL)

1 Like

Hi,

It seems like I am not clear to people reading my posts, so if u like to understand what I am trying to acheive
proceed with the following steps:

  1. Open Amibroker and click on " help" then click on "help contents".
  2. From the contents selecct "AFL" then select "Allphabetical list of all AFL funcions".
  3. In the alphbetical list selecct "line array" then under Reference select "Fibonacci internal and external retracements" (my basic formua came from here - this I modified to plot fib levels in the RHS of the chart-see the first chart posted above).
  4. Kindly scroll down to the end of the formula and read the "comments", - now I am trying to achieve what "Kevin" mentioned on 18th October 2008 (10 years ago !!! and also do the same for time analysis.

If any one has made progress and is willing to share it will be much appreciated.

Hi
i wrote this afl with Not really "messy chart" for me :wink:
@JEETU i dont know if it is very close what you try to do.

_SECTION_BEGIN("xFibo Ver 2");
// Fibonacci Retracements using Gfx* functions by Panos 05-07-2018
// EXAMPLE   xFiboRetracements("P6",colorBlue ) ;

Plot( C, "Price", colorDefault, styleCandle );
GfxSetOverlayMode( 1 ); 
GfxSetCoordsMode( 1 ); // bar/price mode (instead of pixel)

function  xFiboRetracements( StudyID, Color )
{
	trendline = Study(StudyID, GetChartID() );
	bi =BarIndex();
	
	X0= StartX = LastValue( ValueWhen( ExRem( trendline, 0 ), BarIndex() ) );
	X1= EndX = LastValue( ValueWhen( trendline, BarIndex()) );			// printf("X1 StartX  = %g,\n X1 EndX = %g\n", StartX, EndX );
	Y0= StartY = LastValue( ValueWhen( ExRem( trendline, 0 ), trendline ) );
	Y1= EndY = LastValue( ValueWhen( trendline, trendline ) );		// printf("\nY1 StartY  = %g,\nY2  EndY = %g\n", StartY, EndY );

		LineY = ( Y1 - Y0 ) ;
		//y0 = Y1;
		y382 = Y1 - ( LineY * 0.382 );
		y50  = Y1 - ( LineY * 0.50 );
		y618 = Y1 - ( LineY * 0.618 );	// 61.8%
		y786 = Y1 - ( LineY * 0.786 ); 	// 78.6%  
		Y100 = Y0;
		y112 = Y0 - ( LineY * 0.128 );	// 1.128
		y127 = Y0 - ( LineY * 0.272 );	// 1.272
		y161 = Y0 - ( LineY * 0.618 );	// 1.618%

	GfxSelectPen( Color );
	Bars=  bi[x1]-bi[x0];
	if( ParamToggle( "Measuring X & Y ", "No|Yes" )) ext= Bars; else ext= 0;
	GfxMoveTo( X0, y1 );	GfxLineTo( X1+ext, y1 );   // 0% 
	GfxMoveTo( X0, y100 );	GfxLineTo( X1, y100 );   // 100%
		if( ParamToggle( "Show Fibo Retracements? ", "No|Yes" ) )
	{
	GfxMoveTo( X0, y382);	GfxLineTo( X1, y382 );   // 38.2%
	GfxMoveTo( X0, y50 );	GfxLineTo( X1, y50 );   // 50%
	GfxMoveTo( X0, y618 );	GfxLineTo( X1, y618 );   // 61.8%
	GfxMoveTo( X0, y786 );	GfxLineTo( X1, y786 );   // 78.6%
	GfxMoveTo( X0, y112 );	GfxLineTo( X1, y112 );  // 112.8%
	GfxMoveTo( X0, y127 );	GfxLineTo( X1, y127 );  // 127%
	GfxMoveTo( X0, y161 );	GfxLineTo( X1, y161 );  // 161.8%
	}

	if( ParamToggle( "Show Fibo number? ", "No|Yes" ) )
	{
		GfxSelectFont( "Tahoma", 8 );
		GfxSetBkMode( colorDefault );
		GfxSetTextColor( colorBrown );
		GfxTextOut( "0%", X1, y1 );
		GfxTextOut( "100%", X1, y100 );
		GfxSetTextColor( ColorRGB( 100, 200, 100 ) );
		GfxTextOut( "38.2%", X1, y382 );
		GfxTextOut( "50%", X1, y50 );
		GfxTextOut( "61.8%", X1, y618 );
		GfxTextOut( "78.6%", X1, y786 );
		
		GfxSetTextColor( colorBlueGrey );
		GfxTextOut( "112.8%", X1, y112 );
		GfxTextOut( "127%", X1, y127 );
		GfxTextOut( "161.8%", X1, y161 );
	}

		GfxsetBkMode( colorDefault );
		GfxSetTextColor( colorAqua );
		if( ParamToggle( "Bars,Change,% ? ", "No|Yes" ) )
	{  // TrendLine Bars , Change ,Percent
			InfoPosition= Y1 + ( LineY * 0.10 );
		perc = NumToStr(abs(((y1-y0)/(y0+1e-9 ))*100),1.2);
		InfoTxt = "Change: "+abs(LineY)+ ",("+ perc  +  " % ), Bars: "+ Bars+"";
		GfxTextOut( InfoTxt, x0-5, InfoPosition );
	}
	
	if( ParamToggle( "Bars between X & Y ", "No|Yes" ))  GfxTextOut( "Bars: "+Bars  , X0+Bars/3, Y1 );
	
	if( ParamToggle( "Show Gfx Rectangle ", "No|Yes" ) )
	{
	GfxFillSolidRect(   BarCount +3, y112, BarCount +50, y127, color );
	// GfxFillSolidRect(   BarCount -1, y112, Status("pxwidth")-80, y127, color );  // also with Pixels
	// Text inside Rectangle box
	GfxSetTextColor( colorGold);
	GfxSelectFont( "Tahoma", 10 );
	GfxTextOut(  StrFormat("%g - %g",y112,y127 ), BarCount +4, y112+(y127-y112)/2);
	}
}
xFiboRetracements("P1",colorDarkOliveGreen ) ;
xFiboRetracements("P2",colorDarkGreen ) ;
xFiboRetracements("P3",colorDarkTeal ) ;
xFiboRetracements("P4",colorBlueGrey ) ;

_SECTION_END();

12 Likes

Hi PanoS,

You are a genius.

What a lovely surprise I had when I checked my email and then also on the forum.

The information you have provided will keep me busy for some days !

Yes, I still use MTPredictor (MTP) for EOD scanning, will post a few screen shots.

It will be excellent if we can select the pivots (trough low and peak high) using a click of the mouse button,
in MTP selections are with the click of a mouse button.

In MTPredictor there is a drawing tool called "Hi Lo Tag", I have been trying to write an AFL for this, it is

posted above. More on this when I post the screen capture.

Once again, thanks a ton.

One question for you, "is it possible to slow down / pause your video recording"

Thanks again.

1 Like

Hi,

I am trying to post 3 clips;--

[ii]. from MTPredictor - showing the plot of multiple hi / lo tags.

image

[ii]. from Amibroker showing only a tag plotted from the "high".

image

[iii] from Amibroker showing only a tag from a "low"

image

The AFL is;--

t

////// USING LEFT MOUSE BUTTON "CLICK"TO DRAW A HORIZONTAL LINE  AND DISPLAY VALUE OF SELECTED HIGH OR LOW 

_SECTION_BEGIN("MLB CLICK");


GfxSetCoordsMode( 1 );
GfxSetOverlayMode(  0 ) ;
// MLB  click

MLBClicked = GetCursorMouseButtons() ==9;

    MouseX = Nz( GetCursorXPosition( 1 ) );
    MouseY = Nz( GetCursorYPosition( 0 ) );
    

  
selectBi = SelectedValue( BarIndex() );
selectH = SelectedValue( H );
selectL = SelectedValue( L );

    CursoraboveH = MouseY> selectH ;
    CursorbelowL = MouseY < SelectL;
  
if (  CursoraboveH  AND MLBClicked)
    { 
    
GfxSelectPen( colorGreen, 1, 2 );
GfxMoveTo( selectBi, selectH  );
GfxLineTo( BarCount+2, selectH );
 PlotText( "H = "+H, BarCount+3,selectH  ,colorGreen) ; 
    }
if (  CursorbelowL AND MLBClicked )
{
   
GfxSelectPen( colorRed, 1, 2 );
GfxMoveTo( selectBi, selectL  );
GfxLineTo( BarCount+2, selectL );
PlotText( "L = "+L, BarCount+3,selectL  ,colorRed) ;
}

_SECTION_END();


In Amibroker with the above AFL, even though the high / low tag plots it disappears in a few seconds, further
only one tag can be plottes at a time.
The focus at present is to be able to plot as many hi / lo tags as one wants !

The eventual goal is to use the left click of the mouse button to perform multiple tasks, come on guys it is the age of mouse clicks!!

I do not know how to record a video of the screen, once I learn that I will post a recording of the multiple tasks which may be done using the left click of a mouse button.

If it is a coding issue then I request the Amibroker team to provide some support / code snippet for using the left click of a mouse button to perform tasks.

Download Bandicam for free. Easy to use for screen capture of short videos.

1 Like

I recommend this freeware program: https://www.screentogif.com/ for recording short animated gifs. It is worth noting, that only files not larger than 500KB can be uploaded.

1 Like

@JEETU you can do almost everything in AFL (probably 99% of the things you can think of), but each custom solution requires good AFL knowledge and experience. If you lack such skills it will be difficult for you to make a code meeting your criteria. Besides you can already find many codes on the forum making use of mouse button clicks. I gave you a link to one of such codes in my upper link. You can easily find another examples.

I know it might not be the perfect solution in your case, but remember that if you want to avoid clustering your charts with too many objects, you can make use of different custom Layers which can be switched on/off to show or hide groups of objects. You can have as many custom layers as you want - and you can rename them according to your needs. For example:

Layers3

https://www.amibroker.com/guide/h_layers.html
https://www.amibroker.com/video/layers.html

6 Likes