Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Title = " Plan_1 version 14 ";
- /** Plan_1 ver14_Properties.afl,
- // Fibo Time Extension 11-08-18
- // to delete the FTExtention range, highlight. 14-08-18
- // Mouse Above or Below FTExt range 15-08-18
- // Milosz Afl Added 16-08-18
- // ATP Alternate Time Projection - ratio 100% 19-08-18 Εναλλακτική προβολή χρόνου - μελλοντικές χρονικες προβλέψεις τιμών
- // Fibonacci Extention (Expansion) 21-08-18 @link https://tinyurl.com/ybobup6x
- // Fibonacci Retracement 24-08-18
- // Gartley 25-08-18
- // added "Wingdings 3", lookup() and RemoveOneRangeIndex 30-08-18
- // lookup() for intraday charts + Properties 13-09-18
- // NotSafeMouseClick 18-09-18
- // GuiEdid, persistent = True 21-09-18
- // RangeIndex added for every single Group 22-09-18
- // @link https://pastebin.com/mJH4rVGW
- */
- // #include <AFLRevisionInclude3.afl>
- Version(6.28);
- SetBarsRequired( -2,-2); //TO DO: Later we have to FIX this line DO NOT run All the bars
- Plot( C, "Price", colorDefault, stylebar );
- bi = BarIndex();
- tframe = Interval();
- chartID = GetChartID();
- prefix = "OnlyClicksV14" + Name(); // This version includes prefix for ALL statickvars
- nIndex = 6; //nIndex ( is the Num of the loop )
- b = GetCursorMouseButtons();
- { // <<<<< initialize the staticVars ----
- ClickCounter = Nz(StaticVarGet("ClickCounter"+chartID),1); // a Click Counter start from ONE
- RangeIndex = Nz( StaticVarGet( "RangeIndex" ), 1); // a RangeIndex Counter start from ONE
- // reset the RangeIndex back to 1, if used range are more than nIndex
- if (RangeIndex > nIndex-1 ) StaticVarSet( "RangeIndex", 1 );
- SVFTEx = prefix+"FTEx";
- SVFTEy = prefix+"FTEy";
- riFTE = Nz( StaticVarGet( "riFTE" ), 1); if (riFTE > nIndex-1 ) StaticVarSet( "riFTE", 1 ); // Reset the RangeIndex Counter back to 1, if used range are more than nIndex = 5
- FTEx= Nz(StaticVarGet( SVFTEx+riFTE+ClickCounter ),0); // Fibo Time Extension
- FTEy= Nz(StaticVarGet( SVFTEy+riFTE+ClickCounter ),0); // 2 Clicks
- FTEyc = Nz(StaticVarGet( SVFTEy+"C"+riFTE+ClickCounter ),0);
- SVatpx = prefix+"ATPx";
- SVatpy = prefix+"ATPy";
- riATP = Nz( StaticVarGet( "riATP" ), 1); if (riATP > nIndex-1 ) StaticVarSet( "riATP", 1 );
- ATPx = Nz(StaticVarGet( SVatpx +riATP+ClickCounter),0); // Alternate Time Projection
- ATPy = Nz(StaticVarGet( SVatpy +riATP+ClickCounter),0); // 3 Clicks Group
- ATPyc = Nz(StaticVarGet( SVatpy+"C" +riATP+ClickCounter),0);
- // Fibonacci Extention, Expansions can help us determine where price might head after the retracement is exhausted.
- SVfextx = prefix+"EXTx";
- SVfexty = prefix+"EXTy";
- riEXT = Nz( StaticVarGet( "riEXT" ), 1); if (riEXT > nIndex-1 ) StaticVarSet( "riEXT", 1 );
- fextx = Nz(StaticVarGet( SVfextx +riEXT +ClickCounter),0); // Fibo Extention (Expansion)
- fexty = Nz(StaticVarGet( SVfexty +riEXT+ClickCounter),0); // 3 Clicks Group
- SVfRetx = prefix+"FRETx";
- SVfRety = prefix+"FRETy";
- riFRET = Nz( StaticVarGet( "riFRET" ), 1); if (riFRET > nIndex-1 ) StaticVarSet( "riFRET", 1 );
- fretx = Nz(StaticVarGet( SVfRetx+riFRET+ClickCounter),0); // Fibonacci Retracement
- ftety = Nz(StaticVarGet( SVfRety+riFRET+ClickCounter),0); // 2 Clicks Group
- SVGartleyx = prefix+"Gartleyx";
- SVGartleyy = prefix+"Gartleyy";
- Gartleyx = Nz(StaticVarGet( SVGartleyx +ClickCounter),0); // Gartley
- Gartleyy = Nz(StaticVarGet( SVGartleyy +ClickCounter),0); // 5 Clicks Group
- }
- { _SECTION_BEGIN(" FIBONACCI PROPERTIES"); //"Properties" window to select the ratios
- GfxSetOverlayMode( 0 );
- id = GuiGetEvent( 0, 0 ); event = GuiGetEvent( 0, 1 );
- GuiToggle( "FIBS", 40, 5, 18,50, 20, 1 );
- GuiSetColors( 40, 40, 2 , colorWhite, colorCustom16, colorOrange, colorBlack, colorPaleGreen,colorDarkGreen );
- Yaxis= Param( "Y-axis RECT", 68,0,800,1);
- GfxSelectPen( colorGrey40, 3 ); // BORDER
- if (GuiGetCheck(40)) Xaxis= 5; else Xaxis= -300; // Hide/Show Global properties
- /////////// Button For Hide/Show Internal -External - Edit - Remove Window
- Guitoggle( "I",41, 60, 18, 9, 20, 1|64|128); if( id == 41 AND event == 64 ) GfxTextOut( "Internal Ratio", Xaxis+100, Yaxis-20 );
- Guitoggle( "E",42, 70, 18, 9, 20, 1|64|128); if( id == 42 AND event == 64 ) GfxTextOut( "External Ratio", Xaxis+100, Yaxis-20 );
- Guitoggle( "U",43, 80, 18, 9, 20, 1|64|128); if( id == 43 AND event == 64 ) GfxTextOut( "User Ratio", Xaxis+100, Yaxis-20 );
- Guitoggle( "R",44, 90, 18, 9, 20, 1|64|128); if( id == 44 AND event == 64 ) GfxTextOut( "Remove", Xaxis+100, Yaxis-20 );
- //GuiSetColors(41, 44,0, colorBlack, colorRed, colorGold,0, colorDarkGreen, colorPaleGreen,0 , colorGold, colorRed );
- GuiSetColors(41,44 ,0, colorWhite, colorRed, colorBlack, colorDarkGreen, colorLime,colorBlack, colorBlack, colorGold, colorBlack );
- { // <<<<< Main Window properties
- // Visible Window
- win=LR1=LR2=LR3=LD1=LD2=LE1=LE2=LE3=LE4=LE5= 0; Re=45;
- if(GuiGetCheck(41)) win+=1; if(GuiGetCheck(42)) win+=2; if(GuiGetCheck(43)) win+=4; if(GuiGetCheck(44)) win+=8; printf(" win = " +win);
- if (win==1) re=145;
- if (win==2) {re=130; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130;} // External
- if (win==3) {re=250; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250;}
- if (win==4) {re=70; LD1=50; LD2= 70; } // User
- if (win==5) {re=192; LD1=172; LD2= 192; } // Inter User
- if (win==6) {re=130; LD1=170; LD2= 190; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130;}
- if (win==7) {re=295; LD1=275; LD2= 295; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250;}
- if (win==8) {re=70; LR1=49; LR2= 70; } // Remove
- if (win==9) {re=195; LR1=175; LR2= 195; }
- if (win==10) {re=175; LR1=155; LR2= 175; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130;} // External
- if (win==11) {re=298; LR1=278; LR2= 298; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250; }
- if (win==12) {re=116; LD1=50; LD2= 70; LR1=95; LR2= 116; } // User, Remove
- if (win==13) {re=229; LD1=172; LD2= 192; LR1=215; LR2= 229; } // User, Remove
- if (win==14) {re=225; LR1=205; LR2= 225; LD1=160; LD2= 180; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130; } // Edit, Remove External
- if (win==15) {re=340; LR1=323; LR2= 340; LD1=275; LD2= 295; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250; }
- GfxGradientRect( Xaxis-5, Yaxis, Xaxis+200, re+Yaxis+25, ColorRGB( 53, 140,0), ColorRGB( 211, 0,0 ) ); // Main Window
- // This is PIXELS area of the window Properties
- px = GetCursorXPosition(1); py= GetCursorYPosition(1); //printf("px = %g,\t py = %g\n",px , py );
- NotSafeMouseClick= px> Xaxis-5 AND px <Xaxis+200 AND py> Yaxis AND py < re+Yaxis+25 ; //printf("\nNotSafeMouseClick " + NotSafeMouseClick); printf("\nre+Yaxis+70 =" + re+Yaxis+70);
- }
- ////////////////////////////////////////////////////////////////////////
- GfxSetBkMode(1);
- { ///////// BUTTONS Hide-Show fibo Range Group ///////////////
- GuiCheckBox( "", 21, Xaxis+55, Yaxis+5, 13, 13, 1 ); // SELECT FTE
- GuiCheckBox( "", 22, Xaxis+80, Yaxis+5, 13, 13, 1 ); // SELECT ATP
- GuiCheckBox( "", 23, Xaxis+105, Yaxis+5, 13, 13, 1 ); // SELECT INTERNAL RETRACEMENTS
- GuiCheckBox( "", 24, Xaxis+130, Yaxis+5, 13, 13, 1 ); // SELECT EXTERNAL RETRACEMENTS
- GuiCheckBox( "", 20, Xaxis+155, Yaxis+5, 13, 13, 1 ); // Horizontal Lines
- GuiCheckBox( "", 25, Xaxis+180, Yaxis+5, 13, 13, 1 ); // Gatley
- }
- { ///////// BUTTONS to draw NEW RANGE ///////////////
- GfxSetTextColor( colorAqua); GfxSetTextAlign( 6 );
- GfxSelectFont( "Arial", 9, 500);
- GuiSetFont("Verdana",8);
- GuiToggle( "Park", 09, Xaxis+15, Yaxis+20, 31, 24, 1|32|64|128); if( id == 09 AND event == 64 ) GfxTextOut( "Mouse Releaze", Xaxis+100, Yaxis-20 );
- if( id == 09 AND event == 32 ) GfxTextOut( "Disable", Xaxis+100, Yaxis-20 );
- GuiToggle( " FTE ",11, Xaxis+49, Yaxis+20, 25, 24, 1|64|128); if( id == 11 AND event == 64 ) GfxTextOut( "Fibonacci Time Extention", Xaxis+100, Yaxis-20 );
- GuiToggle( " ATP ",12, Xaxis+74, Yaxis+20, 25, 24, 1|64|128); if( id == 12 AND event == 64 ) GfxTextOut( "Alternate Time Projection", Xaxis+100, Yaxis-20 );// Alternate Time Projection
- GuiToggle( " EXT ",13, Xaxis+99, Yaxis+20, 25, 24, 1|64|128); if( id == 13 AND event == 64 ) GfxTextOut( "Fibonacci Expansion", Xaxis+100, Yaxis-20 );// Fibonacci Expansion
- GuiToggle( " RET ",14, Xaxis+124, Yaxis+20, 25, 24, 1|64|128);if( id == 14 AND event == 64 ) GfxTextOut( "Fibonacci Retracement", Xaxis+100, Yaxis-20 );// Fibonacci Retracement
- GuiToggle( " H-L ",10, Xaxis+149, Yaxis+20, 25, 24, 1|64|128); if( id == 10 AND event == 64 ) GfxTextOut( "Horizontal Lines", Xaxis+100, Yaxis-20 );
- GuiToggle( " GAT ",15, Xaxis+174, Yaxis+20, 25, 24, 1|64|128);if( id == 15 AND event == 64 ) GfxTextOut( "Gartley", Xaxis+100, Yaxis-20 );// Gartley
- GuiSetColors(9,15,1, colorWhite, colorGreen, colorLime, colorWhite, colorDarkRed,colorBlack,
- colorBlack, colorGold, colorBlack, /* Select-Text */
- clrdisableText = -1, clrDisBack = -1, clrDisBorder = -1 );
- //GuiSetColors( 9, 15, 1, colorOrange, colorBlack, colorRed, colorYellow, colorBlue, colorYellow, colorYellow, colorBlack, colorYellow );
- }
- { // <<<<< bracket For GuiCheckBox
- GfxSetTextColor( colorblack );
- GfxSelectFont("tahoma", 9, 500 ); //GfxSelectFont( "Segoe UI", 9, 500 );
- GfxTextOut("Hide/Show" , Xaxis+25, Yaxis+3);
- // Gartley
- GuiCheckBox ( "Retrace",35 , Xaxis+179, Yaxis+45, 80, 24, 1);
- GuiSetColors( 35, 35, 3, colorBrown, colorGreen );
- }
- { // <<<<< bracket For INTERNAL RETRACEMENTS ////////
- GfxSelectFont("ARIAL BOLD",10,1000);
- if (GuiGetCheck(41)) IX= 0; else IX= -300;
- // FTE reserve Ids 121- 131
- GuiCheckBox( "", 121, IX+Xaxis+55, Yaxis+70, 13, 13, 1 ); // 38.2%
- GuiCheckBox( "", 122, IX+Xaxis+55, Yaxis+90, 13, 13, 1 ); // 50%
- GuiCheckBox( "", 123, IX+Xaxis+55, Yaxis+110, 13, 13, 1 ); // 61.8%
- GuiCheckBox( "", 124, IX+Xaxis+55, Yaxis+150, 13, 13, 1 ); // 100%
- // ATP reserve Ids 141- 151
- GuiCheckBox( "", 141, IX+Xaxis+80, Yaxis+70, 13, 13, 1 ); // 38.2%
- GuiCheckBox( "", 142, IX+Xaxis+80, Yaxis+90, 13, 13, 1 ); // 50%
- GuiCheckBox( "", 143, IX+Xaxis+80, Yaxis+110, 13, 13, 1 ); // 61.8%
- GuiCheckBox( "", 144, IX+Xaxis+80, Yaxis+150, 13, 13, 1 ); // 100%
- // Extention (Expansion) reserve Ids 161-174
- GuiCheckBox( "",161, IX+Xaxis+105, Yaxis+50, 13, 13, 1 ); // 23.6%
- GuiCheckBox( "",162, IX+Xaxis+105, Yaxis+70, 13, 13, 1 ); // 38.2%
- GuiCheckBox( "",163, IX+Xaxis+105, Yaxis+90, 13, 13, 1 ); // 50%
- GuiCheckBox( "",164, IX+Xaxis+105, Yaxis+110, 13, 13, 1 ); // 61.8%
- GuiCheckBox( "",165, IX+Xaxis+105, Yaxis+130,13, 13, 1 ); // 78.6%
- GuiCheckBox( "",166, IX+Xaxis+105, Yaxis+150, 13, 13, 1 ); // 100%
- //Fibo RETRACEMENTS reserve Ids 181-193
- GuiCheckBox( "",181, IX+Xaxis+130, Yaxis+50, 13, 13, 1 ); // 23.6%
- GuiCheckBox( "",182, IX+Xaxis+130, Yaxis+70, 13, 13, 1 ); // 38.2%
- GuiCheckBox( "",183, IX+Xaxis+130, Yaxis+90, 13, 13, 1 ); // 50%
- GuiCheckBox( "",184, IX+Xaxis+130, Yaxis+110, 13, 13, 1 ); // 61.8%
- GuiCheckBox( "",185, IX+Xaxis+130, Yaxis+130,13, 13, 1 ); // 78.6%
- GuiCheckBox( "",186, IX+Xaxis+130, Yaxis+150, 13, 13, 1 ); // 100%
- GfxTextOut("23.6%" , IX+Xaxis+21, Yaxis+50);
- GfxTextOut("38.2%" , IX+Xaxis+21, Yaxis+70);
- GfxTextOut("50%" , IX+Xaxis+21, Yaxis+90);
- GfxTextOut("61.8%" , IX+Xaxis+21, Yaxis+110);
- GfxTextOut("78.6%" , IX+Xaxis+21, Yaxis+130);
- GfxTextOut("100%" , IX+Xaxis+21, Yaxis+150);
- }
- { // <<<<< bracket For EXTERNAL RETRACEMENTS ////////
- if (GuiGetCheck(42)) eX= 0; else eX= -300;
- GuiCheckBox( "", 125, eX+Xaxis+55, Yaxis+LE2, 13, 13, 1 ); // 127.2% - FTE
- GuiCheckBox( "", 126, eX+Xaxis+55, Yaxis+LE3, 13, 13, 1 ); // 161.8%
- GuiCheckBox( "", 127, eX+Xaxis+55, Yaxis+LE4, 13, 13, 1 ); // 261.8%
- GuiCheckBox( "", 128, eX+Xaxis+55, Yaxis+LE5, 13, 13, 1 ); // 423.6%
- GuiCheckBox( "", 145, eX+Xaxis+80, Yaxis+LE2, 13, 13, 1 ); // 127.2% - ATP
- GuiCheckBox( "", 146, eX+Xaxis+80, Yaxis+LE3, 13, 13, 1 ); // 161.8%
- GuiCheckBox( "", 147, eX+Xaxis+80, Yaxis+LE4, 13, 13, 1 ); // 261.8%
- GuiCheckBox( "", 148, eX+Xaxis+80, Yaxis+LE5, 13, 13, 1 ); // 423.6
- GuiCheckBox( "",167, eX+Xaxis+105, Yaxis+LE1, 13, 13, 1 ); // 112.8% - Extention (Expansion)
- GuiCheckBox( "",168, eX+Xaxis+105, Yaxis+LE2, 13, 13, 1 ); // 127.2%
- GuiCheckBox( "",169, eX+Xaxis+105, Yaxis+LE3, 13, 13, 1 ); // 161.8%
- GuiCheckBox( "",170, eX+Xaxis+105, Yaxis+LE4, 13, 13, 1 ); // 261.8
- GuiCheckBox( "",171, eX+Xaxis+105, Yaxis+LE5, 13, 13, 1 ); // 423.6%
- GuiCheckBox( "",187, eX+Xaxis+130, Yaxis+LE2, 13, 13, 1 ); // 127.2% - Fibo RETRACEMENTS
- GuiCheckBox( "",188, eX+Xaxis+130, Yaxis+LE3, 13, 13, 1 ); // 161.8%
- GuiCheckBox( "",189, eX+Xaxis+130, Yaxis+LE4, 13, 13, 1 ); // 261.8%
- GuiCheckBox( "",190, eX+Xaxis+130, Yaxis+LE5, 13, 13, 1 ); // 423.6%
- GfxTextOut("112.8%", eX+Xaxis+23, Yaxis+ LE1);
- GfxTextOut("127.2%", eX+Xaxis+23, Yaxis+LE2);
- GfxTextOut("161.8%", eX+Xaxis+23, Yaxis+LE3);
- GfxTextOut("261.8%", eX+Xaxis+23, Yaxis+LE4);
- GfxTextOut("423.6%", eX+Xaxis+23, Yaxis+LE5);
- }
- { // <<<<< bracket For USER Manual RATIO ///////////
- if (GuiGetCheck(43)) uX= 0; else uX= -300;
- GTxt7 = StrToNum( StaticVarGettext( Prefix +"User"+ 7 ) ) ;
- GTxt8 = StrToNum( StaticVarGettext( Prefix +"User"+ 8 ) ) ;
- GuiSetFont("arial",9);
- GuiEdit( 7, uX+Xaxis+2, Yaxis+LD1-2, 50,18, 31 ); printf("\n USER ID7= " +GuiGetText( 7 ));
- GuiEdit( 8, uX+Xaxis+2, Yaxis+LD2-2, 50, 18, 31 ); printf("\n USER ID8= " +GuiGetText( 8 )+"\n");
- // GuiSetColors( 7, 8, 2, colorRed, colorBlack, colorRed, colorWhite, colorBlue, colorYellow, colorRed, colorBlack, colorYellow );
- //----- Εαν γραψεις τιμες και πατησεις το ΕΝΤΕΡ τοτε κρατα τις ΝΕΕΣ τιμες σε στατικες -----
- if( id == 7 && event == 8) {StaticVarSettext( Prefix +"User"+ 7, GuiGetText( 7 ),1 ); RequestMouseMoveRefresh(); }
- if( id == 8 && event == 8) {StaticVarSettext( Prefix +"User"+ 8, GuiGetText( 8 ),1 ); RequestMouseMoveRefresh(); }
- // If there are USER Values, read StaticVar and SetText to GuiEdit
- if( StaticVarGettext( Prefix +"User"+ 7 ) !="")
- if( GuiGetText( 7 ) =="") GuiSetText(StaticVarGettext(Prefix+"User"+7),7);
- if( StaticVarGettext( Prefix +"User"+ 8 ) !="")
- if( GuiGetText( 8 ) =="") GuiSetText(StaticVarGettext(Prefix+"User"+8),8);
- GuiCheckBox( "",129, uX+Xaxis+55, Yaxis+LD1, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",130, uX+Xaxis+55, Yaxis+LD2, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",149, uX+Xaxis+80, Yaxis+LD1, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",150, uX+Xaxis+80, Yaxis+LD2, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",172, uX+Xaxis+105, Yaxis+LD1, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",173, uX+Xaxis+105, Yaxis+LD2, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",191, uX+Xaxis+130, Yaxis+LD1, 13, 13, 1 ); // SELECT
- GuiCheckBox( "",192, uX+Xaxis+130, Yaxis+LD2, 13, 13, 1 ); // SELECT
- }
- { // <<<<< Remove - Clear
- ///////// Check - UnCheck All fibo ratio /////////////
- if (GuiGetCheck(44)) rcX= 0; else rcX= -300;
- GuiCheckBox( "",131, rcX+Xaxis+55, Yaxis+LR1, 13, 13, 1 ); // DELETE
- GuiCheckBox( "",151, rcX+Xaxis+80, Yaxis+LR1, 13, 13, 1 ); // DELETE
- GuiCheckBox( "",174, rcX+Xaxis+105, Yaxis+LR1, 13, 13, 1 ); // DELETE
- GuiCheckBox( "",193, rcX+Xaxis+130, Yaxis+LR1, 13, 13, 1 ); // DELETE
- GfxSelectSolidBrush( ColorRGB( 177, 0 ,0 ));
- if ( LR1>0) GfxRoundRect( Xaxis-5, Yaxis+LR1-5, Xaxis+200, Yaxis+LR1+42, 5, 5 ); // to xroma piso apo to group
- GfxSetTextColor( colorOrange );
- GfxTextOut("DELETE" , rcX+Xaxis+25, Yaxis+LR1-1);
- GfxTextOut("RANGE" , rcX+Xaxis+170, Yaxis+LR1-1);
- GuiToggle( "UnCheck All", 110,rcX+Xaxis+50, Yaxis+LR2, 78, 20, 1);
- GuiToggle( "Check All", 111,rcX+Xaxis+127, Yaxis+LR2, 72, 20, 1);
- GuiSetColors( 110, 111, 0 , colorLightYellow, colorBrown, 0, -1, -1,-1,-1,colorred );
- if( GuiGetCheck( 110 ) ) // UnCheck All
- {
- for( i = 121; i < 131; i++ ) GuiSetCheck( i, 0 );
- for( i = 141; i < 151; i++ ) GuiSetCheck( i, 0 );
- for( i = 161; i < 174; i++ ) GuiSetCheck( i, 0 );
- for( i = 181; i < 193; i++ ) GuiSetCheck( i, 0 );
- GuiSetText("Thanks",110); GuiSetCheck( 110, 0 ); // Run the loop ONLY Once
- }
- if( GuiGetCheck( 111 ) ) // Check All
- {
- for( i = 121; i < 131; i++ ) GuiSetCheck( i, 1 );
- for( i = 141; i < 151; i++ ) GuiSetCheck( i, 1 );
- for( i = 161; i < 174; i++ ) GuiSetCheck( i, 1 );
- for( i = 181; i < 193; i++ ) GuiSetCheck( i, 1 );
- GuiSetText("Checked",111); GuiSetCheck( 111, 0 ); // Run the loop ONLY Once
- }
- // Preference delete Range Index
- if (GuiGetCheck(131)) { StaticVarRemove( SVFTEx+"*"); StaticVarRemove( SVFTEy+"*"); GuiSetCheck(131,0); GuiSetCheck(21,0);}
- if (GuiGetCheck(151)) { StaticVarRemove( SVatpx+"*"); StaticVarRemove( SVatpy+"*"); GuiSetCheck(151,0); GuiSetCheck(22,0);}
- if (GuiGetCheck(174)) { StaticVarRemove( SVfextx+"*"); StaticVarRemove( SVfexty+"*"); GuiSetCheck(174,0); GuiSetCheck(23,0);}
- if (GuiGetCheck(193)) { StaticVarRemove( SVfRetx+"*"); StaticVarRemove( SVfRety+"*"); GuiSetCheck(193,0); GuiSetCheck(24,0);}
- //////// xGuiTriger Remove ALL avalable Static Var //////////
- GuiToggle( "ALL",100, rcX+Xaxis+0, Yaxis+LR2, 50, 20, 7 );
- if( GuiGetCheck(100)) //Ask User For confirmation
- {
- GuiToggle( "YES Remove",101, Xaxis+0, Yaxis+LR2+30, 90, 20, 7 );
- GuiToggle( "No Thanks",102, Xaxis+100, Yaxis+LR2+30, 90, 20, 7 );
- if ( GuiGetCheck(101)) { StaticVarRemove( prefix+"*" ); GuiSetCheck(100,0); GuiSetCheck(21,0); GuiSetCheck(22,0); GuiSetCheck(23,0); GuiSetCheck(24,0);}
- if ( GuiGetCheck(102)) GuiSetCheck(100,0);
- RequestMouseMoveRefresh(); // for Local database
- }
- GuiSetColors( 100, 102, 0 , colorLightYellow, colorBrown, 0, -1, -1,-1,-1,colorred );
- }
- _SECTION_END(); }
- // Delete specific range index, press Ctrl and then DoubleClick ON the Circle
- if( GetAsyncKeyState( 17 ) < 0 ) { RequestMouseMoveRefresh(); GfxCircle( GetCursorXPosition(1), GetCursorYPosition(1), 5 ); }
- function RemoveOneRangeIndex( ButtonID, CheckID , SVx, SVy )
- {
- global y0, x0;
- if( GetAsyncKeyState( 17 ) < 0 )
- if( GuiGetCheck( ButtonID ) == 0 AND GuiGetCheck( CheckID ) == 1 ) // Allowed to Delete Only if range button is OFF
- {
- y= GetCursorYPosition(0);
- x= GetCursorXPosition(0);
- RequestMouseMoveRefresh();
- GfxSelectSolidBrush( colorred ); GfxSelectPen( colorYellow );
- GfxCircle( x0, y0, 0.5 ); // place a Circle - Dot in the chart
- pnt1 = y0 + ( y0 * 0.001 ); pnt2 = y0 - ( y0 * 0.001 ); // +- Yaxis
- if( y < pnt1 AND Y >pnt2 AND x0 == Lookup(bi,x) )
- {
- GfxSelectFont( "Arial", 12, 500 );
- GfxTextOut( "Remove", X0+5, y0 ); // Horizontal line
- if( b & 9 )
- {
- StaticVarRemove( SVx );
- StaticVarRemove( SVy );
- }
- }
- }
- }
- //--------- Check if any NEW button is pressed ---------
- // οταν πιεζεις ενα απο τα κουμπια η λουπα αυτη μηδενιζει ΟΛΑ τα υπολοιπα κουμπια
- function CheckOneId( idCheck ) // Check if any NEW button is pressed
- {
- for( i = 9; i < 16 ; i++ ) // when a new button pressed then reset ALL the other Buttons
- {
- GuisetCheck( i, 0 ) ;
- }
- GuisetCheck( idCheck, 1 ) ;
- StaticVarRemove( "ClickCounter*"); // if Clicks are half way through and other Button presed, then restart the counter
- }
- if( id == 9 & event == 1 ) { CheckOneId(id);} // park
- if( id == 10 & event == 1 ) { CheckOneId(id);} // hori-Lines
- if( id == 11 & event == 1 ) { CheckOneId(id);}
- if( id == 12 & event == 1 ) { CheckOneId(id);}
- if( id == 13 & event == 1 ) { CheckOneId(id);}
- if( id == 14 & event == 1 ) { CheckOneId(id);}
- if( id == 15 & event == 1 ) { CheckOneId(id);}
- // GuiSetColors( 10, 12, 0, colorLightBlue, colorBrown ,0,0,0,0,colorYellow,colorblack);
- //=========== IF switcher is ON do this amound of clicks ====================
- totalClick = 0;
- if( GuiGetCheck(11) ) totalClick = 2; // Time Extention
- if( GuiGetCheck(12) ) totalClick = 3; // Alternate Time Projection
- if( GuiGetCheck(13) ) totalClick = 3; // fibo Extention
- if( GuiGetCheck(14) ) totalClick = 2; // fibo Retracement
- if( GuiGetCheck(15) ) totalClick = 5; // Gartley
- ///---------if Left button is Pressed -----------------------------
- if( b & 8 AND NOT NotSafeMouseClick) // flag = 8 is set when window just received mouse click
- {
- x = GetCursorXPosition( 0 ); // X-coordinate in DateTime format. y - value gives PRICE
- y = GetCursorYPosition( 0 );
- barNo = Lookup( bi, x, 0);
- if( b & 1 AND barNo >0 )
- {
- ///////////////////////////////////////////////////////////////////
- ////////////////// Fibo Time Extention - 2 Clicks ////////////////
- if( GuiGetCheck(11) AND ClickCounter <= totalClick )
- {
- StaticVarSet( SVFTEx +riFTE + ClickCounter, x,1 ); // DateTime of the bar ...
- StaticVarSet( SVFTEy +riFTE + ClickCounter, y,1 );
- if( ClickCounter == 1 ) StaticVarSet( SVFTEy+"C" +riFTE + ClickCounter, SelectedValue(C),1 ); // close of the bar
- // _TRACE("#, Message ClickCounter= " + ClickCounter + " FTEyc"+ StaticVarGet( SVFTEy+"C" +riFTE + ClickCounter) );
- StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 ); // Add +1 to ClickCounter
- Say( "" + ClickCounter ); Say( "Range " + riFTE,0 );
- GuiSetCheck( 21,1 ); // swich ON to show the FTE
- if( ClickCounter == 2 ) // Once the last mouse Click has occured
- {
- StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
- StaticVarSet( "riFTE", riFTE+1 ); // add plus +1 to RangeIndex Counter
- GuisetCheck( 11, 0 ) ; // Reset the button toggle
- }
- }
- //////////////////////////////////////////////////////////////////////////
- ////////////////// Fibonacci Retracement - 2 Clicks /////////////////////
- if( GuiGetCheck(14) AND ClickCounter <= totalClick )
- {
- StaticVarSet( SVfRetx +riFRET + ClickCounter, x,1 ); // DateTime of the bar ...
- StaticVarSet( SVfRety +riFRET + ClickCounter, y,1 );
- StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 ); // Add +1 to ClickCounter
- Say( "" + ClickCounter ); Say( "Range " + riFRET,0 );
- GuiSetCheck( 24,1 ); // swich ON to show the Retracement
- if( ClickCounter == 2 ) // Once the last mouse Click has occured
- {
- StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
- StaticVarSet( "riFRET", riFRET+1 ); // add plus +1 to RangeIndex Counter
- GuisetCheck( 14, 0 ) ; // Reset the button toggle
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- ////////////////// ATP Alternate Time Projection - 3 Clicks ///////////////
- if( GuiGetCheck(12) AND ClickCounter <= totalClick )
- {
- StaticVarSet( SVatpx +riATP + ClickCounter, x,1 );
- StaticVarSet( SVatpy +riATP + ClickCounter, y,1 );
- if( ClickCounter == 1 ) StaticVarSet( SVatpy+"C" +riATP+ClickCounter, SelectedValue(C),1 ); // close of the bar
- _TRACE("#, Message ClickCounter= " + ClickCounter + " SVatpyC"+ StaticVarGet( SVatpy+"C" +riATP+ClickCounter) );
- StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 );
- Say( "" + ClickCounter ); Say( "Range " + riATP,0 );
- GuiSetCheck(22,1);
- if( ClickCounter == 3 ) // Once the last mouse Click has occured
- {
- StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
- StaticVarSet( "riATP", riATP+1 ); // add plus +1 to RangeIndex Counter
- GuisetCheck(12,0 ) ; // Reset the button toggle
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- ////////////////// Fibonacci Extention (Expansion) - 3 Clicks //////////////
- if( GuiGetCheck(13) AND ClickCounter <= totalClick )
- {
- StaticVarSet( SVfextx +riEXT + ClickCounter, x,1);
- StaticVarSet( SVfexty +riEXT + ClickCounter, y,1 );
- StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 );
- Say( "" + ClickCounter ); Say( "Range " + riEXT,0 );
- GuiSetCheck( 23,1 ); // Click button 23 to show me the lines
- if( ClickCounter == 3 ) // Once the last mouse Click has occured
- {
- StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
- StaticVarSet( "riEXT", riEXT+1 ); // add plus +1 to RangeIndex Counter
- GuisetCheck( 13, 0 ) ; // Reset the button toggle
- }
- }
- ///////////////////////////////////////////////////////////////////
- ////////////////// Gartley - 5 Clicks ////////////////////////////////
- if( GuiGetCheck(15) AND ClickCounter <= totalClick ) // if Button 15 is ON.... and IF ClickCounter is less equal than 5 ( ClickCounter<=5 )
- {
- StaticVarSet( SVGartleyx +ClickCounter , x,1 );
- StaticVarSet( SVGartleyy +ClickCounter , y,1 );
- StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 ); // Add +1 to ClickCounter
- Say( "" + ClickCounter , 0 );
- GuiSetCheck( 25,1 );
- if( ClickCounter == 5 ) // Once the last mouse Click has occured
- {
- StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
- GuisetCheck( 15, 0 ) ; // Reset the button toggle
- }
- }
- }
- }
- //////////// TextOut the Next Click or the range /////////////////////////////
- // if(DebugOn) _TRACE("#, Message ClickCounter= " + ClickCounter);
- if( ( GuiGetCheck(11) OR GuiGetCheck(12) OR GuiGetCheck(13) OR GuiGetCheck(14) OR GuiGetCheck(15)) AND ClickCounter<= totalClick)
- {
- GfxsetBkMode( 1 ); // 1 set transparent mode
- GfxSetTextColor( colorYellow );
- GfxSelectFont("Times New Roman", 13, 700, True );
- GfxTextOut( " Place " + ClickCounter + " of ( " + totalClick + " Clicks ) ", 100 ,status( "pxchartbottom" )-20);
- }
- /////////////////////////////////////////////////////////////
- // PART 1 Fibo Time Extension
- /////////////////////////////////////////////////////////////
- //GfxSetOverlayMode( 1 );
- GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
- for( i = 1; i < nIndex ; i++ )
- {
- x0 = Lookup(bi,StaticVarGet( SVFTEx + i + "1" )); // return the bar index of the specific datetime
- x1 = Lookup(bi,StaticVarGet( SVFTEx + i + "2" ));
- y0 = StaticVarGet( SVFTEy + i + "1" );
- y1 = StaticVarGet( SVFTEy + i + "2" );
- y0C = StaticVarGet( SVFTEy + "C" + i + "1" );
- // _TRACE( "# , FTE nIndex " + i );
- //-----------------------------------------------------
- // Code For Clicks Above or Below Bar - Compare Mouse Position with the (Y0 and Close) of the first Click
- if( y0 > y0C ) mousePosition = 1; else mousePosition = 0;
- // if( b & 9 ) _TRACE( "#, y0 " + y0 + ", y0C = " + y0C + " mousePosition " + mousePosition );
- if( mousePosition ) { TxtPos = 5; fnt = "$"; fntPos = -10; }
- else { TxtPos = -15; fnt = "#"; fntPos = -1; }
- //-----End --- Code For Above or Below ---------
- if( GuiGetCheck(21) ) // show/ hide the FText lines
- {
- if( x0 != 0 AND x1 != 0 ) // draw on chart if range is selected
- {
- Bars = x1 - x0; // printf( "range bars " + bars );
- x382 = round(x1 + bars * 0.382);
- x50 = round(x1 + bars * 0.5);
- X618 = round(x1 + bars * 0.618);
- X100 = x1 + Bars;
- X1272 = round(x1 + bars * 1.272);
- X1618 = round(x1 + bars * 1.618);
- x200 = x1 + bars * 2 ;
- X2618 = round(x1 + bars * 2.618);
- Xs7 = round(x1 + bars * GTxt7 ); // User Value
- Xs8 = round(x1 + bars * GTxt8 );
- color = 33 + i ;
- GfxSelectPen( color, 1, 0 );
- GfxMoveTo( X0, y0 ); GfxLineTo( x1618, y0 ); // Horizontal line - PLOTS AT THE LEVEL OF Y0 = 1st CLICK
- GfxsetBkMode( 1 ); // 1 set transparent mode
- GfxSetTextColor( color ); GfxSetTextAlign( 6 );
- //GfxSelectFont( "Arial", 8, 500, 0, 0, 900 ); // vertical fonts
- fsize=8; // fontsize
- PlotTextSetFont( "FTE:(" + i + ")", "ARIAL", fsize, x0, y0, color, colorDefault, TxtPos );
- PlotTextSetFont( "EB:" + bars, "ARIAL", fsize, x1, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(121)) PlotTextSetFont( "38.2%" , "ARIAL", fsize, x382, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(123)) PlotTextSetFont( "61.8%" , "ARIAL", fsize, x618-1, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(124)) PlotTextSetFont( "100%" , "ARIAL", fsize, x100-1, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(125)) PlotTextSetFont( "1272%" , "ARIAL", fsize, x1272 - 2, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(126)) PlotTextSetFont( "161.8%" , "ARIAL", fsize, x1618 - 2, y0, color, colorDefault, TxtPos );
- // if (GuiGetCheck(46)) PlotTextSetFont( "200%" , "ARIAL", fsize, x200 - 1, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(127)) PlotTextSetFont( "261.8%" , "ARIAL", fsize, X2618 - 1, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(128)) PlotTextSetFont( "261.8%" , "ARIAL", fsize, X2618 - 1, y0, color, colorDefault, TxtPos );
- if (GTxt7>0) if (GuiGetCheck(129)) PlotTextSetFont( ""+GTxt7+"%" , "ARIAL", fsize, Xs7 - 1, y0, color, colorDefault, TxtPos ); // User Value
- if (GTxt8>0) if (GuiGetCheck(130)) PlotTextSetFont( ""+GTxt8+"%" , "ARIAL", fsize, Xs8 - 1, y0, color, colorDefault, TxtPos ); // User Value
- xfonts="Wingdings 3";
- PlotTextSetFont( fnt , xfonts, 10, x0, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x1, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x382, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x618, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x100, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x1272, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x1618, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x200, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x2618, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, Xs7, y0, color, colorDefault, fntPos ); // User Value
- PlotTextSetFont( fnt , xfonts, 10, Xs8, y0, color, colorDefault, fntPos ); // User Value
- }
- RemoveOneRangeIndex( 11, 21 , SVFTEx + i + "*", SVFTEy + i + "*" );
- }
- }// end loop
- // END Fibo Time Extension
- //////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////
- // PART 2 ATP Alternate Time Projection - ratio 100%
- /////////////////////////////////////////////////////////////
- function UserClickError(x0,x1,x2)
- { // Notify the user if the clicks are NOT in series
- local x0;x1;x2;
- if(x0 > x1 or x0 > x2 or x1 > x2 )
- GfxSetCoordsMode( 0 ); GfxsetBkMode( 1 ); GfxSetTextColor( colorred ); GfxTextOut( "ATP, User ERROR: Try again" ,350 , 50 );
- }
- //GfxSetOverlayMode( 1 );
- GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
- for ( i =1; i < nIndex ; i++ )
- {
- x0 = Lookup(bi,StaticVarGet( SVatpx+i+"1" ));
- x1 = Lookup(bi,StaticVarGet( SVatpx+i+"2" ));
- x2 = Lookup(bi,StaticVarGet( SVatpx+i+"3" ));
- y0 = StaticVarGet( SVatpy+i+"1" );
- y1 = StaticVarGet( SVatpy+i+"2" );
- y2 = StaticVarGet( SVatpy+i+"3" );
- y0C = StaticVarGet( SVatpy+"C" + i + "1" );
- //if( b == 9 ) _TRACE( "#, ATP x0 " + x0 + " x1 " + x1 + " x2 " + x2 );
- // _TRACE( "# , ATP nIndex " + i );
- //-----------------------------------------------------
- // Code For Clicks Above or Below Bar - Compare Mouse Position with the (Y0 and Close) of the first Click
- if( y0 > y0C ) mousePosition = 1; else mousePosition = 0;
- // if( b & 9 ) _TRACE( "#, y0 " + y0 + ", y0C = " + y0C + " mousePosition " + mousePosition );
- if( mousePosition ) { TxtPos = 5; fnt = "$"; fntPos = -10; }
- else { TxtPos = -15; fnt = "#"; fntPos = -1; }
- //-----End --- Code For Above or Below ---------
- if (GuiGetCheck(22)) // show/ hide the ATP lines
- {
- if( x0 != 0 AND x2 != 0 AND x1 != 0 ) // draw on chart if range is selected
- {
- UserClickError(x0,x1,x2); // Notify the user if the clicks are NOT in series
- // _TRACE( "# , ATP nIndex (" + i + " ) GuiGetCheck(22)" + GuiGetCheck(22) );
- AB = x1 - x0;
- P618 = round( x2 + AB * 0.618 ) ; //61.8%
- ATP = x2 + AB ; // AB PROJECTED FROM "C" (bi[x2] ) =100%
- P1272 = round(x2 + AB * 1.272) ; //127.2%
- P1618 = round(x2 + AB * 1.618) ; //161.8%
- P200 = x2 + AB * 2; //200%
- P2618 = round(x2 + AB * 2.618) ; //261.8%
- Xs7 = round(x2 + AB * GTxt7 ); // User Value
- Xs8 = round(x2 + AB * GTxt8 );
- color = 33 + i ;
- GfxSelectPen( color, 1, 0 );
- GfxMoveTo( X0, y0 ); GfxLineTo( P2618, y0 ); // Horizontal line - PLOTS AT THE LEVEL OF Y0 = 1st CLICK
- GfxsetBkMode( 1 ); // 1 set transparent mode
- GfxSetTextColor( color ); GfxSetTextAlign( 6 );
- //GfxSelectFont( "Arial", 9, 500, 0, 0, 900 ); // vertical fonts
- fsize=8; // fontsize
- PlotTextSetFont( "ATP:(" + i + ")", "ARIAL", fsize, x0, y0, color, colorDefault, TxtPos );
- PlotTextSetFont( "EB:", "ARIAL", fsize, x1, y0, color, colorDefault, TxtPos );
- PlotTextSetFont( "FROM" , "ARIAL", fsize, x2, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(143)) PlotTextSetFont( "61.8%" , "ARIAL", fsize, P618, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(144)) PlotTextSetFont( "100%" , "ARIAL", fsize, ATP, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(146)) PlotTextSetFont( "161.8%" , "ARIAL", fsize, P1618, y0, color, colorDefault, TxtPos );
- //if (GuiGetCheck(000)) PlotTextSetFont( "200%" , "ARIAL", fsize, P200, y0, color, colorDefault, TxtPos );
- if (GuiGetCheck(147)) PlotTextSetFont( "2618%" , "ARIAL", fsize, P2618, y0, color, colorDefault, TxtPos );
- if (GTxt7>0) if (GuiGetCheck(149)) PlotTextSetFont( ""+GTxt7+"%" , "ARIAL", fsize, Xs7 - 1, y0, color, colorDefault, TxtPos ); // User Value
- if (GTxt8>0) if (GuiGetCheck(150)) PlotTextSetFont( ""+GTxt8+"%" , "ARIAL", fsize, Xs8 - 1, y0, color, colorDefault, TxtPos ); // User Value
- xfonts="Wingdings 3";
- PlotTextSetFont( fnt , xfonts, 10, x0, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x1, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, x2, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, p618, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, ATP, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, p1272, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, p1618, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, p200, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, p2618, y0, color, colorDefault, fntPos );
- PlotTextSetFont( fnt , xfonts, 10, Xs7, y0, color, colorDefault, fntPos ); // User Value
- PlotTextSetFont( fnt , xfonts, 10, Xs8, y0, color, colorDefault, fntPos ); // User Value
- }
- RemoveOneRangeIndex( 12, 22 , SVatpx+i+"*", SVatpy+i+"*" );
- }
- }// end index loop
- // END ATP Alternate Time Projection - ratio 100%
- //////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////
- // PART 3 Fibonacci Extention (Expansion)
- /////////////////////////////////////////////////////////////
- GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
- for ( i =1; i < nIndex ; i++ )
- {
- x0 = Lookup(bi,StaticVarGet( SVfextx+i+"1" ));
- x1 = Lookup(bi,StaticVarGet( SVfextx+i+"2" ));
- x2 = Lookup(bi,StaticVarGet( SVfextx+i+"3" ));
- y0 = StaticVarGet( SVfexty+i+"1" );
- y1 = StaticVarGet( SVfexty+i+"2" );
- y2 = StaticVarGet( SVfexty+i+"3" );
- if(GuiGetCheck(23)) // show/ hide the FText lines
- {
- if( x0 != 0 AND x2 != 0 ) // draw on chart if range is selected
- {
- yRange = ( y1 - y0 ) ;
- y_000 = y0 + yRange;
- y_038 = y2 + ( yRange * 0.382 ); // 38.2%
- y_050 = y2 + ( yRange * 0.500 ); // 50.0%
- y_061 = y2 + ( yRange * 0.618 ); // 61.8%
- y_078 = y2 + ( yRange * 0.786 ); // 78.6%
- // if( b == 9 ) _TRACE( "#, ATP y_000= " + y_000 + ", yRange =" + yRange + ", y_050 =" + y_050 );
- Y_100 = y2+ yRange;
- y_112 = y2+( yRange * 1.128 ) ; // 112.8%
- y_127 = y2+( yRange * 1.272 ) ; // 127.2%
- y_161 = y2+( yRange * 1.618 ) ; // 161.8%
- y_261 = y2+( yRange * 2.618 ) ; // 261.8%
- Xs7 = y2+( yRange * GTxt7 ); // User Value
- Xs8 = y2+( yRange * GTxt8 ) ;
- color = 33 + i ;
- GfxSelectPen( color, 1, penstyle = 1 ); // penstyle: Dash=1, Dot=2
- GfxMoveTo( X0, y0 ); GfxLineTo( x1, y1 ); GfxLineTo( x2, y2 ); // wave line 1,2,3
- // Extentions
- GfxSelectPen( colorGreen, 1, penstyle = 2 );
- GfxMoveTo( X1, y_038 ); GfxLineTo( x2, y_038 );
- GfxMoveTo( X1, y_050 ); GfxLineTo( x2, y_050 );
- GfxMoveTo( X1, y_061 ); GfxLineTo( x2, y_061 ); // 61.8%
- GfxMoveTo( X1, (y1-y0)+y2 ); GfxLineTo( x2, Y_100 ); // 100.0%
- GfxMoveTo( X1, y_112 ); GfxLineTo( x2, y_112 ); // 112.8%
- GfxMoveTo( X1, y_127 ); GfxLineTo( x2, y_127 ); // 127.2%
- GfxMoveTo( X1, y_161 ); GfxLineTo( x2, y_161 ); // 161.6%
- GfxMoveTo( X1, y_261 ); GfxLineTo( x2, y_261 ); // 261.8%
- GfxMoveTo( X1, Xs7 ); GfxLineTo( x2, Xs7 ); // User Value
- GfxMoveTo( X1, Xs8 ); GfxLineTo( x2, Xs8 );
- // text out
- GfxsetBkMode( 1 );
- GfxSetTextColor( colorGold );
- GfxSelectFont( "Arial", 8, 500 );
- GfxTextOut( "("+i+")", x1 , y1 ); // show range Index
- if (GuiGetCheck(162)) GfxTextOut( "38.2%" , x2 , y_038 );
- if (GuiGetCheck(163)) GfxTextOut( "50%" , x2 , y_050 );
- if (GuiGetCheck(164)) GfxTextOut( "61.8%" , x2 , y_061 );
- if (GuiGetCheck(165)) GfxTextOut( "78.6%" , x2 , y_078 );
- if (GuiGetCheck(166)) GfxTextOut( "100%" , x2 , y_100 );
- if (GuiGetCheck(167)) GfxTextOut( "112.8%", x2 , y_112 );
- if (GuiGetCheck(168)) GfxTextOut( "127.2%", x2 , y_127 );
- if (GuiGetCheck(169)) GfxTextOut( "161%" , x2 , y_161 );
- if (GuiGetCheck(170)) GfxTextOut( "261.8%", x2 , y_261 );
- if (GTxt7>0) if (GuiGetCheck(172)) GfxTextOut( ""+GTxt7+"%", x2 , Xs7 ); // User Value
- if (GTxt8>0) if (GuiGetCheck(173)) GfxTextOut( ""+GTxt8+"%", x2 , Xs8 );
- }
- // Delete specific range index, press Ctrl and then DoubleClick ON the Circle
- RemoveOneRangeIndex( 13, 23 , SVfextx+i+"*", SVfexty+i+"*" );
- }
- } //end index loop
- // END Fibonacci Extention (Expansion)
- //////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////
- // PART 4 Fibonacci Retracement
- /////////////////////////////////////////////////////////////
- GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
- for ( i =1; i < nIndex ; i++ )
- {
- x0 = Lookup(bi,StaticVarGet( SVfRetx+i+"1" ));
- x1 = Lookup(bi,StaticVarGet( SVfRetx+i+"2" ));
- y0 = StaticVarGet( SVfRety+i+"1" );
- y1 = StaticVarGet( SVfRety+i+"2" );
- if( x0 > x1 ) // if right To left
- {
- x1 = Lookup(bi,StaticVarGet( SVfRetx+i+ "1" ));
- x0 = Lookup(bi,StaticVarGet( SVfRetx+i+ "2" ));
- y1 = StaticVarGet( SVfRety +i+ "1" );
- y0 = StaticVarGet( SVfRety +i+ "2" );
- }
- if(GuiGetCheck(24)) // show/ hide Retracement lines
- {
- if( x0 != 0 AND X1 != 0 ) // draw on chart if range is selected
- {
- 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 = Y1 - ( LineY * 1.128 ); // 1.128
- y127 = Y1 - ( LineY * 1.272 ); // 1.272
- y161 = Y1 - ( LineY * 1.618 ); // 1.618%
- y261 = Y1 - ( LineY * 2.618 ); // 261.8%
- y423 = Y1 - ( LineY * 4.236 ); // 423.6%
- Ys7 = Y1 - ( LineY * GTxt7 ); // User Value
- Ys8 = Y1 - ( LineY * GTxt8 );
- // temporary show me a line - how the my 2 clicks are conected
- GfxSelectPen( colorBlue, 1, penstyle = 1 ); // penstyle: Dash=1, Dot=2
- GfxMoveTo( X0, y0 ); GfxLineTo( x1, y1 );
- Color= colorBlue;
- GfxSelectPen( Color );
- Bars= x1 - 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%
- GfxMoveTo( X0, y261 ); GfxLineTo( X1, y261 ); // 261.8%
- GfxMoveTo( X0, y423 ); GfxLineTo( X1, y423 ); // 423.6%
- GfxMoveTo( X0, Ys7 ); GfxLineTo( X1, Ys7 ); // SELECTED (Παίρνοντας τιμές από Στατικές)
- GfxMoveTo( X0, Ys8 ); GfxLineTo( X1, Ys8 ); // User Value
- //}
- //if( ParamToggle( "Show Fibo number? ", "No|Yes" ) )
- //{
- GfxSelectFont( "Tahoma", 8 );
- GfxSetBkMode( colorDefault );
- GfxSetTextColor( colorBrown );
- GfxTextOut( "("+i+")", x0 , y1 ); // show range Index
- GfxTextOut( "0%", X1, y1 );
- GfxTextOut( "100%", X1, y100 );
- GfxSetTextColor( ColorRGB( 100, 200, 100 ) );
- if (GuiGetCheck(182)) GfxTextOut( "38.2%", X1, y382 );
- if (GuiGetCheck(183)) GfxTextOut( "50%", X1, y50 );
- if (GuiGetCheck(184)) GfxTextOut( "61.8%", X1, y618 );
- if (GuiGetCheck(185)) GfxTextOut( "78.6%", X1, y786 );
- GfxSetTextColor( colorBlueGrey );
- if (GuiGetCheck(162)) GfxTextOut( "112.8%", X1, y112 );
- if (GuiGetCheck(187)) GfxTextOut( "127%", X1, y127 );
- if (GuiGetCheck(188)) GfxTextOut( "161.8%", X1, y161 );
- if (GuiGetCheck(189)) GfxTextOut( "261.8%", X1, y261 );
- if (GuiGetCheck(190)) GfxTextOut( "423.6%", X1, y423 );
- if (GTxt7>0) if(GuiGetCheck(191)) GfxTextOut( ""+GTxt7+"%", X1, Ys7 );
- if (GTxt8>0) if (GuiGetCheck(192)) GfxTextOut( ""+GTxt8+"%", X1, Ys8 );
- //}
- GfxsetBkMode( colorDefault );
- GfxSetTextColor( colorAqua );
- if( ParamToggle( "Bars,Change,% ? ", "No|Yes" ) )
- { // TrendLine Bars , Change ,Percent
- InfoPosition= Y1 + ( LineY * 0.05 );
- perc = NumToStr(abs(((y1-y0)/(y0+1e-9 ))*100),1.2);
- InfoTxt = "Change: "+abs(LineY)+ ",("+ perc + " % ), Bars: "+ Bars+"";
- GfxTextOut( InfoTxt, X0+Bars/4, 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 +20, 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+11.5, y112+(y127-y112)/2);
- }
- // Delete specific range index, press Ctrl and then Click ON the Circle
- RemoveOneRangeIndex( 14, 24 , SVfRety+i+"*", SVfRetx+i+"*");
- }
- }
- } // end index loop
- // END Fibonacci Retracement
- //////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////
- // PART 5 Gartley
- /////////////////////////////////////////////////////////////
- /// @link https://www.youtube.com/watch?v=mBmNQlYFF6M Bat Pattern
- /// @link https://www.youtube.com/watch?v=hn8vsw8zoew Gartley Pattern
- /// @link https://www.youtube.com/watch?v=2Q3ozkuF17s
- GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
- xX = Lookup(bi,StaticVarGet( SVGartleyx+"1" ));
- xA = Lookup(bi,StaticVarGet( SVGartleyx+"2" ));
- xB = Lookup(bi,StaticVarGet( SVGartleyx+"3" ));
- xC = Lookup(bi,StaticVarGet( SVGartleyx+"4" ));
- xD = Lookup(bi,StaticVarGet( SVGartleyx+"5" ));
- yX = StaticVarGet( SVGartleyy+"1" );
- yA = StaticVarGet( SVGartleyy+"2" );
- yB = StaticVarGet( SVGartleyy+"3" );
- yC = StaticVarGet( SVGartleyy+"4" );
- yD = StaticVarGet( SVGartleyy+"5" );
- if(GuiGetCheck(25)) // show/ hide the Gartley
- {
- if( xx != 0 AND xb != 0 ) // draw on chart if range is selected
- {
- Bars = xa - xx;
- LineXA = ( ya - yx ) ;
- y000 = yx - LineXA;
- y012 = round(ya - ( LineXA * 0.114 )); // 11.4%
- y038 = round(ya - ( LineXA * 0.382 )); // 38.2%
- //y_050 = yb + ( LineXA * 0.500 ); // 50.0%
- y061 = round(ya - ( LineXA * 0.618 )); // 61.8%
- y127 = Yx - ( LineXA * 0.272 ); // 127.2%
- y161 = Yx - ( LineXA * 0.618 ); // 1.618%
- y261 = Yx - ( LineXA * 1.618 ); // 261.8%
- // Conect the Gartley 5 Points
- GfxSelectPen( colorBlue ); // penstyle: Dash=1, Dot=2
- GfxMoveTo( Xx, yx ); GfxLineTo( xa, ya ); GfxLineTo( xb, yb ); GfxLineTo( xc, yc ); GfxLineTo( xd, yd );
- // Label the Gartley 5 Points
- GfxsetBkMode( 1 );
- GfxSetTextAlign( 6 );
- GfxSelectFont( "Arial", 8);
- GfxSetTextColor( colorBlueGrey );
- GfxTextOut( "X", Xx, yx ); GfxTextOut( "A", Xa, ya ); GfxTextOut( "B " +yb , Xb, yb ); GfxTextOut( "C", Xc, yc ); GfxTextOut( "D", xd, yd );
- if (GuiGetCheck(35)) // Show retrace
- {
- // if point B retrace between 38.2 AND 61.8 levels. this gives us a potential Crab Pattern
- GfxSelectPen( colorGreen, 1, penstyle = 2 );
- if (yb > y061 AND yb < y038) // για κατω Crab
- {
- GfxSelectPen( colorGreen, 1, penstyle = 2 );
- GfxMoveTo( Xa, y038 ); GfxLineTo( xb, y038 );
- GfxMoveTo( Xa, y061 ); GfxLineTo( xb, y061 ); // 61.8%
- GfxTextOut( "38.2% "+y038 , xb , y038 );
- GfxTextOut( "61.8% "+y061 , xb , y061 );
- }
- // if point C retrace min to 38.2 and max to 11.4 (88.6) Crab Pattern still valid
- if( xc != 0) { GfxMoveTo( Xa, y012 ); GfxLineTo( xc, y012 ); GfxTextOut( "11.4%" , xc , y012 ); }
- if ( yc < y038 AND yc > y012) GfxTextOut( "NoT Crab" , xc+8 , y012 );
- // Crab target
- if ( yc > y038 AND yc < y012)
- { // παραλληλόγραμμο - parallelogram
- GfxFillSolidRect( xb+Bars*1.618 , y127, xc +Bars*1.618, y161, colorBlue);
- GfxTextOut( "Crab Target" , xc+Bars , y127 );
- }
- }
- // https://learn.tradimo.com/advanced-chart-patterns/gartley-pattern
- // RemoveOneRangeIndex( 15, 25 , SVGartleyx+i+"*", SVGartleyy+i+"*");
- // to delete the FTE range Hold down Ctrl, then select the Start Bar of the range, show to the user informations how to.
- if ( GetAsyncKeyState( 17 ) < 0 ) // if Ctrl Pressed show to the user informations
- { XL= Lookup(bi,StaticVarGet( SVGartleyx+"1" ));
- if( b & 9 AND xX== SelectedValue( XL)) // delete the range if you select the Start Bar
- {
- StaticVarRemove(SVGartleyx+i+"*");
- StaticVarRemove(SVGartleyy+i+"*");
- }
- }
- }
- }
- // END Gartley
- //////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////
- // PART 10 Horizontal Lines
- /////////////////////////////////////////////////////////////
- /// @link https://forum.amibroker.com/t/help-with-iif-function-in-a-loop-how-to-check-if-the-code-is-efficient/7187/7
- // By --- Milosz Mazurkiewicz ---
- // minor changes by Anderson Wilson
- // GuiButtons added By Panos
- // Title = " Ctrl + Left Mouse Button on chart --> Select/Clear selected spots | Ctrl + Left Mouse Button on the right axis area --> Delete all spots";
- LookBackPeriod = 500;
- SetBarsRequired( LookBackPeriod );
- IdSet = Name() + Interval() + GetChartID();
- ConditionArray = Nz( StaticVarGet( prefix+"ConditionArray" + IdSet ) );
- //bi = BarIndex();
- // MouseButtonPressed = GetCursorMouseButtons();
- // CtrlPressed = GetAsyncKeyState( 17 ) < 0 ;
- x = GetCursorXPosition( 0 );
- // y = GetCursorYPosition( 0 );
- if(GuiGetCheck(10))
- {
- x = LastValue( ValueWhen( x == DateTime(), bi ) );
- if( b & 8 ) // LMB --> Select spots
- {
- GuiSetCheck(20,1); // turn ON GuiCheck
- if (GuiGetCheck(10))
- if( x == 0 AND IsEmpty( y ) ) // remove all lines at once clicking on the right axis area
- { ConditionArray = 0; Say("Remove ALL"); }
- else
- if( ConditionArray[x] ) // remove Selected line
- {ConditionArray[x] = 0; Say("0");}
- else
- {ConditionArray[x] = 1; Say("1"); } // Add a line to the chart
- StaticVarSet( prefix+"ConditionArray" + IdSet, ConditionArray, persist = False );
- }
- }
- if(GuiGetCheck(20)) // hide / Show Horizontal Lines
- {
- fvbi = Status( "firstvisiblebarindex" );
- lvbi = Status( "lastvisiblebarindex" );
- pxchr = Status( "pxchartright" );
- //GfxSetZOrder( -1 );
- GfxSelectFont( "Arial Narrow", 9, 700, False );
- Start = Max( 0, fvbi - LookBackPeriod );
- End = Min( lvbi, BarCount - 1 );
- for( i = Start; i <= End ; i++ )
- {
- if( ConditionArray[i] )
- {
- if( C[i] > O[i] ) Color = colorGreen;
- else
- if( C[i] < O[i] ) Color = colorRed;
- else Color = colorBlue;
- Spot = C[i];
- GfxSetCoordsMode( 1 );
- GfxSelectPen( Color, 2 );
- GfxSelectSolidBrush( Color );
- GfxCircle( i, Spot, -5 );
- GfxMoveTo( i, Spot );
- GfxLineTo( lvbi , Spot );
- GfxSetCoordsMode( 2 );
- GfxSetTextColor( Color );
- GfxTextOut( "" + Spot, pxchr + 3, Spot );
- }
- }
- }
- // END Horizontal Lines
- /////////////////////////////////////////////////////////////
- _TRACE( "# , Code end ---------------------- " );
- /*
- //////// FOR intepritation window - show me what statick vars i have until now
- // print the Fibo Time Extension
- "<b> \nFTEx11= " +StaticVarGet( SVFTEx+"11" ) + ",\t FTEy11= " +StaticVarGet( SVFTEy+"11" ) +
- "\nFTEx12= " +StaticVarGet( SVFTEx+"12" ) + ",\t FTEy12= " +StaticVarGet( SVFTEy+"12" ) ;
- "\nFTEx21= " +StaticVarGet( SVFTEx+"21" ) + ",\t FTEy21= " +StaticVarGet( SVFTEy+"21" ) +
- "\nFTEx22= " +StaticVarGet( SVFTEx+"22" ) + ",\t FTEy22= " +StaticVarGet( SVFTEy+"22" ) ;
- "\nFTEx31= " +StaticVarGet( SVFTEx+"31" ) + ",\t FTEy31= " +StaticVarGet( SVFTEy+"31" ) +
- "\nFTEx32= " +StaticVarGet( SVFTEx+"32" ) + ",\t FTEy32= " +StaticVarGet( SVFTEy+"32" ) ;
- "\nFTEyc11= " +StaticVarGet( SVFTEy+"C11" ) + ",\t FTEyc21= " +StaticVarGet( SVFTEy+"C11" ) +
- "\nFTEyc31= " +StaticVarGet( SVFTEy+"C31" ) + ",\t FTEyc41= " +StaticVarGet( SVFTEy+"C41" ) ;
- */
- EncodeColor( colorBlue);
- "\n<b> Read all pending events \n";
- for( i = 0; GuiGetEvent( i, 0 ); i++ )
- {
- id = GuiGetEvent( i, 0 );
- code = GuiGetEvent( i, 1 );
- text = GuiGetEvent( i, 2 );
- printf("\n Id\t" +id + "\nCode \t" +code + "\nText \t" +text + "</b>");
- }
Add Comment
Please, Sign In to add comment