panosbouf

Fibonacci Mouse_Clicks

Sep 25th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.38 KB | None | 0 0
  1. Title = " Plan_1 version 14 ";
  2. /** Plan_1 ver14_Properties.afl,
  3. // Fibo Time Extension 11-08-18
  4. // to delete the FTExtention range, highlight. 14-08-18
  5. // Mouse Above or Below FTExt range 15-08-18
  6. // Milosz Afl Added 16-08-18
  7. // ATP Alternate Time Projection - ratio 100% 19-08-18 Εναλλακτική προβολή χρόνου - μελλοντικές χρονικες προβλέψεις τιμών
  8. // Fibonacci Extention (Expansion) 21-08-18 @link https://tinyurl.com/ybobup6x
  9. // Fibonacci Retracement 24-08-18
  10. // Gartley 25-08-18
  11. // added "Wingdings 3", lookup() and RemoveOneRangeIndex 30-08-18
  12. // lookup() for intraday charts + Properties 13-09-18
  13. // NotSafeMouseClick 18-09-18
  14. // GuiEdid, persistent = True 21-09-18
  15. // RangeIndex added for every single Group 22-09-18
  16. // @link https://pastebin.com/mJH4rVGW
  17. */
  18.  
  19.  
  20.  
  21. // #include <AFLRevisionInclude3.afl>
  22. Version(6.28);
  23. SetBarsRequired( -2,-2); //TO DO: Later we have to FIX this line DO NOT run All the bars
  24.  
  25. Plot( C, "Price", colorDefault, stylebar );
  26. bi = BarIndex();
  27. tframe = Interval();
  28. chartID = GetChartID();
  29.  
  30. prefix = "OnlyClicksV14" + Name(); // This version includes prefix for ALL statickvars
  31. nIndex = 6; //nIndex ( is the Num of the loop )
  32. b = GetCursorMouseButtons();
  33.  
  34.  
  35. { // <<<<< initialize the staticVars ----
  36. ClickCounter = Nz(StaticVarGet("ClickCounter"+chartID),1); // a Click Counter start from ONE
  37.  
  38. RangeIndex = Nz( StaticVarGet( "RangeIndex" ), 1); // a RangeIndex Counter start from ONE
  39. // reset the RangeIndex back to 1, if used range are more than nIndex
  40. if (RangeIndex > nIndex-1 ) StaticVarSet( "RangeIndex", 1 );
  41.  
  42. SVFTEx = prefix+"FTEx";
  43. SVFTEy = prefix+"FTEy";
  44. 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
  45. FTEx= Nz(StaticVarGet( SVFTEx+riFTE+ClickCounter ),0); // Fibo Time Extension
  46. FTEy= Nz(StaticVarGet( SVFTEy+riFTE+ClickCounter ),0); // 2 Clicks
  47. FTEyc = Nz(StaticVarGet( SVFTEy+"C"+riFTE+ClickCounter ),0);
  48.  
  49. SVatpx = prefix+"ATPx";
  50. SVatpy = prefix+"ATPy";
  51. riATP = Nz( StaticVarGet( "riATP" ), 1); if (riATP > nIndex-1 ) StaticVarSet( "riATP", 1 );
  52. ATPx = Nz(StaticVarGet( SVatpx +riATP+ClickCounter),0); // Alternate Time Projection
  53. ATPy = Nz(StaticVarGet( SVatpy +riATP+ClickCounter),0); // 3 Clicks Group
  54. ATPyc = Nz(StaticVarGet( SVatpy+"C" +riATP+ClickCounter),0);
  55.  
  56. // Fibonacci Extention, Expansions can help us determine where price might head after the retracement is exhausted.
  57. SVfextx = prefix+"EXTx";
  58. SVfexty = prefix+"EXTy";
  59. riEXT = Nz( StaticVarGet( "riEXT" ), 1); if (riEXT > nIndex-1 ) StaticVarSet( "riEXT", 1 );
  60. fextx = Nz(StaticVarGet( SVfextx +riEXT +ClickCounter),0); // Fibo Extention (Expansion)
  61. fexty = Nz(StaticVarGet( SVfexty +riEXT+ClickCounter),0); // 3 Clicks Group
  62.  
  63. SVfRetx = prefix+"FRETx";
  64. SVfRety = prefix+"FRETy";
  65. riFRET = Nz( StaticVarGet( "riFRET" ), 1); if (riFRET > nIndex-1 ) StaticVarSet( "riFRET", 1 );
  66. fretx = Nz(StaticVarGet( SVfRetx+riFRET+ClickCounter),0); // Fibonacci Retracement
  67. ftety = Nz(StaticVarGet( SVfRety+riFRET+ClickCounter),0); // 2 Clicks Group
  68.  
  69. SVGartleyx = prefix+"Gartleyx";
  70. SVGartleyy = prefix+"Gartleyy";
  71. Gartleyx = Nz(StaticVarGet( SVGartleyx +ClickCounter),0); // Gartley
  72. Gartleyy = Nz(StaticVarGet( SVGartleyy +ClickCounter),0); // 5 Clicks Group
  73.  
  74. }
  75.  
  76. { _SECTION_BEGIN(" FIBONACCI PROPERTIES"); //"Properties" window to select the ratios
  77. GfxSetOverlayMode( 0 );
  78.  
  79. id = GuiGetEvent( 0, 0 ); event = GuiGetEvent( 0, 1 );
  80.  
  81. GuiToggle( "FIBS", 40, 5, 18,50, 20, 1 );
  82. GuiSetColors( 40, 40, 2 , colorWhite, colorCustom16, colorOrange, colorBlack, colorPaleGreen,colorDarkGreen );
  83. Yaxis= Param( "Y-axis RECT", 68,0,800,1);
  84. GfxSelectPen( colorGrey40, 3 ); // BORDER
  85.  
  86. if (GuiGetCheck(40)) Xaxis= 5; else Xaxis= -300; // Hide/Show Global properties
  87.  
  88. /////////// Button For Hide/Show Internal -External - Edit - Remove Window
  89. Guitoggle( "I",41, 60, 18, 9, 20, 1|64|128); if( id == 41 AND event == 64 ) GfxTextOut( "Internal Ratio", Xaxis+100, Yaxis-20 );
  90. Guitoggle( "E",42, 70, 18, 9, 20, 1|64|128); if( id == 42 AND event == 64 ) GfxTextOut( "External Ratio", Xaxis+100, Yaxis-20 );
  91. Guitoggle( "U",43, 80, 18, 9, 20, 1|64|128); if( id == 43 AND event == 64 ) GfxTextOut( "User Ratio", Xaxis+100, Yaxis-20 );
  92. Guitoggle( "R",44, 90, 18, 9, 20, 1|64|128); if( id == 44 AND event == 64 ) GfxTextOut( "Remove", Xaxis+100, Yaxis-20 );
  93. //GuiSetColors(41, 44,0, colorBlack, colorRed, colorGold,0, colorDarkGreen, colorPaleGreen,0 , colorGold, colorRed );
  94. GuiSetColors(41,44 ,0, colorWhite, colorRed, colorBlack, colorDarkGreen, colorLime,colorBlack, colorBlack, colorGold, colorBlack );
  95.  
  96. { // <<<<< Main Window properties
  97.  
  98. // Visible Window
  99. win=LR1=LR2=LR3=LD1=LD2=LE1=LE2=LE3=LE4=LE5= 0; Re=45;
  100. if(GuiGetCheck(41)) win+=1; if(GuiGetCheck(42)) win+=2; if(GuiGetCheck(43)) win+=4; if(GuiGetCheck(44)) win+=8; printf(" win = " +win);
  101.  
  102. if (win==1) re=145;
  103. if (win==2) {re=130; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130;} // External
  104. if (win==3) {re=250; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250;}
  105. if (win==4) {re=70; LD1=50; LD2= 70; } // User
  106. if (win==5) {re=192; LD1=172; LD2= 192; } // Inter User
  107. if (win==6) {re=130; LD1=170; LD2= 190; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130;}
  108. if (win==7) {re=295; LD1=275; LD2= 295; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250;}
  109. if (win==8) {re=70; LR1=49; LR2= 70; } // Remove
  110. if (win==9) {re=195; LR1=175; LR2= 195; }
  111. if (win==10) {re=175; LR1=155; LR2= 175; LE1=50; LE2=70; LE3=90; LE4=110; LE5=130;} // External
  112. if (win==11) {re=298; LR1=278; LR2= 298; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250; }
  113. if (win==12) {re=116; LD1=50; LD2= 70; LR1=95; LR2= 116; } // User, Remove
  114. if (win==13) {re=229; LD1=172; LD2= 192; LR1=215; LR2= 229; } // User, Remove
  115. 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
  116. if (win==15) {re=340; LR1=323; LR2= 340; LD1=275; LD2= 295; LE1=170; LE2=190; LE3=210; LE4=230; LE5=250; }
  117.  
  118. GfxGradientRect( Xaxis-5, Yaxis, Xaxis+200, re+Yaxis+25, ColorRGB( 53, 140,0), ColorRGB( 211, 0,0 ) ); // Main Window
  119. // This is PIXELS area of the window Properties
  120. px = GetCursorXPosition(1); py= GetCursorYPosition(1); //printf("px = %g,\t py = %g\n",px , py );
  121. 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);
  122.  
  123. }
  124.  
  125.  
  126. ////////////////////////////////////////////////////////////////////////
  127. GfxSetBkMode(1);
  128. { ///////// BUTTONS Hide-Show fibo Range Group ///////////////
  129. GuiCheckBox( "", 21, Xaxis+55, Yaxis+5, 13, 13, 1 ); // SELECT FTE
  130. GuiCheckBox( "", 22, Xaxis+80, Yaxis+5, 13, 13, 1 ); // SELECT ATP
  131. GuiCheckBox( "", 23, Xaxis+105, Yaxis+5, 13, 13, 1 ); // SELECT INTERNAL RETRACEMENTS
  132. GuiCheckBox( "", 24, Xaxis+130, Yaxis+5, 13, 13, 1 ); // SELECT EXTERNAL RETRACEMENTS
  133. GuiCheckBox( "", 20, Xaxis+155, Yaxis+5, 13, 13, 1 ); // Horizontal Lines
  134. GuiCheckBox( "", 25, Xaxis+180, Yaxis+5, 13, 13, 1 ); // Gatley
  135. }
  136.  
  137.  
  138. { ///////// BUTTONS to draw NEW RANGE ///////////////
  139. GfxSetTextColor( colorAqua); GfxSetTextAlign( 6 );
  140. GfxSelectFont( "Arial", 9, 500);
  141.  
  142. GuiSetFont("Verdana",8);
  143. 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 );
  144. if( id == 09 AND event == 32 ) GfxTextOut( "Disable", Xaxis+100, Yaxis-20 );
  145. 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 );
  146. 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
  147. 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
  148. 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
  149. 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 );
  150. 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
  151. GuiSetColors(9,15,1, colorWhite, colorGreen, colorLime, colorWhite, colorDarkRed,colorBlack,
  152. colorBlack, colorGold, colorBlack, /* Select-Text */
  153. clrdisableText = -1, clrDisBack = -1, clrDisBorder = -1 );
  154.  
  155. //GuiSetColors( 9, 15, 1, colorOrange, colorBlack, colorRed, colorYellow, colorBlue, colorYellow, colorYellow, colorBlack, colorYellow );
  156. }
  157.  
  158. { // <<<<< bracket For GuiCheckBox
  159. GfxSetTextColor( colorblack );
  160. GfxSelectFont("tahoma", 9, 500 ); //GfxSelectFont( "Segoe UI", 9, 500 );
  161. GfxTextOut("Hide/Show" , Xaxis+25, Yaxis+3);
  162.  
  163. // Gartley
  164. GuiCheckBox ( "Retrace",35 , Xaxis+179, Yaxis+45, 80, 24, 1);
  165. GuiSetColors( 35, 35, 3, colorBrown, colorGreen );
  166.  
  167. }
  168.  
  169.  
  170. { // <<<<< bracket For INTERNAL RETRACEMENTS ////////
  171. GfxSelectFont("ARIAL BOLD",10,1000);
  172.  
  173. if (GuiGetCheck(41)) IX= 0; else IX= -300;
  174.  
  175. // FTE reserve Ids 121- 131
  176. GuiCheckBox( "", 121, IX+Xaxis+55, Yaxis+70, 13, 13, 1 ); // 38.2%
  177. GuiCheckBox( "", 122, IX+Xaxis+55, Yaxis+90, 13, 13, 1 ); // 50%
  178. GuiCheckBox( "", 123, IX+Xaxis+55, Yaxis+110, 13, 13, 1 ); // 61.8%
  179. GuiCheckBox( "", 124, IX+Xaxis+55, Yaxis+150, 13, 13, 1 ); // 100%
  180.  
  181. // ATP reserve Ids 141- 151
  182. GuiCheckBox( "", 141, IX+Xaxis+80, Yaxis+70, 13, 13, 1 ); // 38.2%
  183. GuiCheckBox( "", 142, IX+Xaxis+80, Yaxis+90, 13, 13, 1 ); // 50%
  184. GuiCheckBox( "", 143, IX+Xaxis+80, Yaxis+110, 13, 13, 1 ); // 61.8%
  185. GuiCheckBox( "", 144, IX+Xaxis+80, Yaxis+150, 13, 13, 1 ); // 100%
  186.  
  187. // Extention (Expansion) reserve Ids 161-174
  188. GuiCheckBox( "",161, IX+Xaxis+105, Yaxis+50, 13, 13, 1 ); // 23.6%
  189. GuiCheckBox( "",162, IX+Xaxis+105, Yaxis+70, 13, 13, 1 ); // 38.2%
  190. GuiCheckBox( "",163, IX+Xaxis+105, Yaxis+90, 13, 13, 1 ); // 50%
  191. GuiCheckBox( "",164, IX+Xaxis+105, Yaxis+110, 13, 13, 1 ); // 61.8%
  192. GuiCheckBox( "",165, IX+Xaxis+105, Yaxis+130,13, 13, 1 ); // 78.6%
  193. GuiCheckBox( "",166, IX+Xaxis+105, Yaxis+150, 13, 13, 1 ); // 100%
  194.  
  195. //Fibo RETRACEMENTS reserve Ids 181-193
  196. GuiCheckBox( "",181, IX+Xaxis+130, Yaxis+50, 13, 13, 1 ); // 23.6%
  197. GuiCheckBox( "",182, IX+Xaxis+130, Yaxis+70, 13, 13, 1 ); // 38.2%
  198. GuiCheckBox( "",183, IX+Xaxis+130, Yaxis+90, 13, 13, 1 ); // 50%
  199. GuiCheckBox( "",184, IX+Xaxis+130, Yaxis+110, 13, 13, 1 ); // 61.8%
  200. GuiCheckBox( "",185, IX+Xaxis+130, Yaxis+130,13, 13, 1 ); // 78.6%
  201. GuiCheckBox( "",186, IX+Xaxis+130, Yaxis+150, 13, 13, 1 ); // 100%
  202.  
  203. GfxTextOut("23.6%" , IX+Xaxis+21, Yaxis+50);
  204. GfxTextOut("38.2%" , IX+Xaxis+21, Yaxis+70);
  205. GfxTextOut("50%" , IX+Xaxis+21, Yaxis+90);
  206. GfxTextOut("61.8%" , IX+Xaxis+21, Yaxis+110);
  207. GfxTextOut("78.6%" , IX+Xaxis+21, Yaxis+130);
  208. GfxTextOut("100%" , IX+Xaxis+21, Yaxis+150);
  209.  
  210. }
  211.  
  212. { // <<<<< bracket For EXTERNAL RETRACEMENTS ////////
  213. if (GuiGetCheck(42)) eX= 0; else eX= -300;
  214.  
  215. GuiCheckBox( "", 125, eX+Xaxis+55, Yaxis+LE2, 13, 13, 1 ); // 127.2% - FTE
  216. GuiCheckBox( "", 126, eX+Xaxis+55, Yaxis+LE3, 13, 13, 1 ); // 161.8%
  217. GuiCheckBox( "", 127, eX+Xaxis+55, Yaxis+LE4, 13, 13, 1 ); // 261.8%
  218. GuiCheckBox( "", 128, eX+Xaxis+55, Yaxis+LE5, 13, 13, 1 ); // 423.6%
  219. GuiCheckBox( "", 145, eX+Xaxis+80, Yaxis+LE2, 13, 13, 1 ); // 127.2% - ATP
  220. GuiCheckBox( "", 146, eX+Xaxis+80, Yaxis+LE3, 13, 13, 1 ); // 161.8%
  221. GuiCheckBox( "", 147, eX+Xaxis+80, Yaxis+LE4, 13, 13, 1 ); // 261.8%
  222. GuiCheckBox( "", 148, eX+Xaxis+80, Yaxis+LE5, 13, 13, 1 ); // 423.6
  223. GuiCheckBox( "",167, eX+Xaxis+105, Yaxis+LE1, 13, 13, 1 ); // 112.8% - Extention (Expansion)
  224. GuiCheckBox( "",168, eX+Xaxis+105, Yaxis+LE2, 13, 13, 1 ); // 127.2%
  225. GuiCheckBox( "",169, eX+Xaxis+105, Yaxis+LE3, 13, 13, 1 ); // 161.8%
  226. GuiCheckBox( "",170, eX+Xaxis+105, Yaxis+LE4, 13, 13, 1 ); // 261.8
  227. GuiCheckBox( "",171, eX+Xaxis+105, Yaxis+LE5, 13, 13, 1 ); // 423.6%
  228. GuiCheckBox( "",187, eX+Xaxis+130, Yaxis+LE2, 13, 13, 1 ); // 127.2% - Fibo RETRACEMENTS
  229. GuiCheckBox( "",188, eX+Xaxis+130, Yaxis+LE3, 13, 13, 1 ); // 161.8%
  230. GuiCheckBox( "",189, eX+Xaxis+130, Yaxis+LE4, 13, 13, 1 ); // 261.8%
  231. GuiCheckBox( "",190, eX+Xaxis+130, Yaxis+LE5, 13, 13, 1 ); // 423.6%
  232. GfxTextOut("112.8%", eX+Xaxis+23, Yaxis+ LE1);
  233. GfxTextOut("127.2%", eX+Xaxis+23, Yaxis+LE2);
  234. GfxTextOut("161.8%", eX+Xaxis+23, Yaxis+LE3);
  235. GfxTextOut("261.8%", eX+Xaxis+23, Yaxis+LE4);
  236. GfxTextOut("423.6%", eX+Xaxis+23, Yaxis+LE5);
  237.  
  238. }
  239.  
  240. { // <<<<< bracket For USER Manual RATIO ///////////
  241. if (GuiGetCheck(43)) uX= 0; else uX= -300;
  242.  
  243. GTxt7 = StrToNum( StaticVarGettext( Prefix +"User"+ 7 ) ) ;
  244. GTxt8 = StrToNum( StaticVarGettext( Prefix +"User"+ 8 ) ) ;
  245. GuiSetFont("arial",9);
  246. GuiEdit( 7, uX+Xaxis+2, Yaxis+LD1-2, 50,18, 31 ); printf("\n USER ID7= " +GuiGetText( 7 ));
  247. GuiEdit( 8, uX+Xaxis+2, Yaxis+LD2-2, 50, 18, 31 ); printf("\n USER ID8= " +GuiGetText( 8 )+"\n");
  248. // GuiSetColors( 7, 8, 2, colorRed, colorBlack, colorRed, colorWhite, colorBlue, colorYellow, colorRed, colorBlack, colorYellow );
  249. //----- Εαν γραψεις τιμες και πατησεις το ΕΝΤΕΡ τοτε κρατα τις ΝΕΕΣ τιμες σε στατικες -----
  250. if( id == 7 && event == 8) {StaticVarSettext( Prefix +"User"+ 7, GuiGetText( 7 ),1 ); RequestMouseMoveRefresh(); }
  251. if( id == 8 && event == 8) {StaticVarSettext( Prefix +"User"+ 8, GuiGetText( 8 ),1 ); RequestMouseMoveRefresh(); }
  252.  
  253. // If there are USER Values, read StaticVar and SetText to GuiEdit
  254. if( StaticVarGettext( Prefix +"User"+ 7 ) !="")
  255. if( GuiGetText( 7 ) =="") GuiSetText(StaticVarGettext(Prefix+"User"+7),7);
  256. if( StaticVarGettext( Prefix +"User"+ 8 ) !="")
  257. if( GuiGetText( 8 ) =="") GuiSetText(StaticVarGettext(Prefix+"User"+8),8);
  258.  
  259.  
  260. GuiCheckBox( "",129, uX+Xaxis+55, Yaxis+LD1, 13, 13, 1 ); // SELECT
  261. GuiCheckBox( "",130, uX+Xaxis+55, Yaxis+LD2, 13, 13, 1 ); // SELECT
  262. GuiCheckBox( "",149, uX+Xaxis+80, Yaxis+LD1, 13, 13, 1 ); // SELECT
  263. GuiCheckBox( "",150, uX+Xaxis+80, Yaxis+LD2, 13, 13, 1 ); // SELECT
  264. GuiCheckBox( "",172, uX+Xaxis+105, Yaxis+LD1, 13, 13, 1 ); // SELECT
  265. GuiCheckBox( "",173, uX+Xaxis+105, Yaxis+LD2, 13, 13, 1 ); // SELECT
  266. GuiCheckBox( "",191, uX+Xaxis+130, Yaxis+LD1, 13, 13, 1 ); // SELECT
  267. GuiCheckBox( "",192, uX+Xaxis+130, Yaxis+LD2, 13, 13, 1 ); // SELECT
  268. }
  269.  
  270. { // <<<<< Remove - Clear
  271. ///////// Check - UnCheck All fibo ratio /////////////
  272. if (GuiGetCheck(44)) rcX= 0; else rcX= -300;
  273.  
  274.  
  275. GuiCheckBox( "",131, rcX+Xaxis+55, Yaxis+LR1, 13, 13, 1 ); // DELETE
  276. GuiCheckBox( "",151, rcX+Xaxis+80, Yaxis+LR1, 13, 13, 1 ); // DELETE
  277. GuiCheckBox( "",174, rcX+Xaxis+105, Yaxis+LR1, 13, 13, 1 ); // DELETE
  278. GuiCheckBox( "",193, rcX+Xaxis+130, Yaxis+LR1, 13, 13, 1 ); // DELETE
  279.  
  280. GfxSelectSolidBrush( ColorRGB( 177, 0 ,0 ));
  281.  
  282. if ( LR1>0) GfxRoundRect( Xaxis-5, Yaxis+LR1-5, Xaxis+200, Yaxis+LR1+42, 5, 5 ); // to xroma piso apo to group
  283.  
  284.  
  285. GfxSetTextColor( colorOrange );
  286. GfxTextOut("DELETE" , rcX+Xaxis+25, Yaxis+LR1-1);
  287. GfxTextOut("RANGE" , rcX+Xaxis+170, Yaxis+LR1-1);
  288.  
  289. GuiToggle( "UnCheck All", 110,rcX+Xaxis+50, Yaxis+LR2, 78, 20, 1);
  290. GuiToggle( "Check All", 111,rcX+Xaxis+127, Yaxis+LR2, 72, 20, 1);
  291. GuiSetColors( 110, 111, 0 , colorLightYellow, colorBrown, 0, -1, -1,-1,-1,colorred );
  292. if( GuiGetCheck( 110 ) ) // UnCheck All
  293. {
  294. for( i = 121; i < 131; i++ ) GuiSetCheck( i, 0 );
  295. for( i = 141; i < 151; i++ ) GuiSetCheck( i, 0 );
  296. for( i = 161; i < 174; i++ ) GuiSetCheck( i, 0 );
  297. for( i = 181; i < 193; i++ ) GuiSetCheck( i, 0 );
  298. GuiSetText("Thanks",110); GuiSetCheck( 110, 0 ); // Run the loop ONLY Once
  299. }
  300.  
  301. if( GuiGetCheck( 111 ) ) // Check All
  302. {
  303. for( i = 121; i < 131; i++ ) GuiSetCheck( i, 1 );
  304. for( i = 141; i < 151; i++ ) GuiSetCheck( i, 1 );
  305. for( i = 161; i < 174; i++ ) GuiSetCheck( i, 1 );
  306. for( i = 181; i < 193; i++ ) GuiSetCheck( i, 1 );
  307. GuiSetText("Checked",111); GuiSetCheck( 111, 0 ); // Run the loop ONLY Once
  308. }
  309. // Preference delete Range Index
  310. if (GuiGetCheck(131)) { StaticVarRemove( SVFTEx+"*"); StaticVarRemove( SVFTEy+"*"); GuiSetCheck(131,0); GuiSetCheck(21,0);}
  311. if (GuiGetCheck(151)) { StaticVarRemove( SVatpx+"*"); StaticVarRemove( SVatpy+"*"); GuiSetCheck(151,0); GuiSetCheck(22,0);}
  312. if (GuiGetCheck(174)) { StaticVarRemove( SVfextx+"*"); StaticVarRemove( SVfexty+"*"); GuiSetCheck(174,0); GuiSetCheck(23,0);}
  313. if (GuiGetCheck(193)) { StaticVarRemove( SVfRetx+"*"); StaticVarRemove( SVfRety+"*"); GuiSetCheck(193,0); GuiSetCheck(24,0);}
  314.  
  315. //////// xGuiTriger Remove ALL avalable Static Var //////////
  316. GuiToggle( "ALL",100, rcX+Xaxis+0, Yaxis+LR2, 50, 20, 7 );
  317. if( GuiGetCheck(100)) //Ask User For confirmation
  318. {
  319. GuiToggle( "YES Remove",101, Xaxis+0, Yaxis+LR2+30, 90, 20, 7 );
  320. GuiToggle( "No Thanks",102, Xaxis+100, Yaxis+LR2+30, 90, 20, 7 );
  321. if ( GuiGetCheck(101)) { StaticVarRemove( prefix+"*" ); GuiSetCheck(100,0); GuiSetCheck(21,0); GuiSetCheck(22,0); GuiSetCheck(23,0); GuiSetCheck(24,0);}
  322. if ( GuiGetCheck(102)) GuiSetCheck(100,0);
  323. RequestMouseMoveRefresh(); // for Local database
  324. }
  325. GuiSetColors( 100, 102, 0 , colorLightYellow, colorBrown, 0, -1, -1,-1,-1,colorred );
  326. }
  327.  
  328.  
  329. _SECTION_END(); }
  330.  
  331.  
  332.  
  333.  
  334. // Delete specific range index, press Ctrl and then DoubleClick ON the Circle
  335. if( GetAsyncKeyState( 17 ) < 0 ) { RequestMouseMoveRefresh(); GfxCircle( GetCursorXPosition(1), GetCursorYPosition(1), 5 ); }
  336. function RemoveOneRangeIndex( ButtonID, CheckID , SVx, SVy )
  337. {
  338. global y0, x0;
  339. if( GetAsyncKeyState( 17 ) < 0 )
  340. if( GuiGetCheck( ButtonID ) == 0 AND GuiGetCheck( CheckID ) == 1 ) // Allowed to Delete Only if range button is OFF
  341. {
  342. y= GetCursorYPosition(0);
  343. x= GetCursorXPosition(0);
  344. RequestMouseMoveRefresh();
  345. GfxSelectSolidBrush( colorred ); GfxSelectPen( colorYellow );
  346. GfxCircle( x0, y0, 0.5 ); // place a Circle - Dot in the chart
  347. pnt1 = y0 + ( y0 * 0.001 ); pnt2 = y0 - ( y0 * 0.001 ); // +- Yaxis
  348.  
  349. if( y < pnt1 AND Y >pnt2 AND x0 == Lookup(bi,x) )
  350. {
  351. GfxSelectFont( "Arial", 12, 500 );
  352. GfxTextOut( "Remove", X0+5, y0 ); // Horizontal line
  353.  
  354. if( b & 9 )
  355. {
  356. StaticVarRemove( SVx );
  357. StaticVarRemove( SVy );
  358. }
  359. }
  360. }
  361. }
  362.  
  363.  
  364.  
  365. //--------- Check if any NEW button is pressed ---------
  366. // οταν πιεζεις ενα απο τα κουμπια η λουπα αυτη μηδενιζει ΟΛΑ τα υπολοιπα κουμπια
  367. function CheckOneId( idCheck ) // Check if any NEW button is pressed
  368. {
  369. for( i = 9; i < 16 ; i++ ) // when a new button pressed then reset ALL the other Buttons
  370. {
  371. GuisetCheck( i, 0 ) ;
  372. }
  373. GuisetCheck( idCheck, 1 ) ;
  374. StaticVarRemove( "ClickCounter*"); // if Clicks are half way through and other Button presed, then restart the counter
  375. }
  376.  
  377.  
  378. if( id == 9 & event == 1 ) { CheckOneId(id);} // park
  379. if( id == 10 & event == 1 ) { CheckOneId(id);} // hori-Lines
  380. if( id == 11 & event == 1 ) { CheckOneId(id);}
  381. if( id == 12 & event == 1 ) { CheckOneId(id);}
  382. if( id == 13 & event == 1 ) { CheckOneId(id);}
  383. if( id == 14 & event == 1 ) { CheckOneId(id);}
  384. if( id == 15 & event == 1 ) { CheckOneId(id);}
  385. // GuiSetColors( 10, 12, 0, colorLightBlue, colorBrown ,0,0,0,0,colorYellow,colorblack);
  386.  
  387. //=========== IF switcher is ON do this amound of clicks ====================
  388. totalClick = 0;
  389. if( GuiGetCheck(11) ) totalClick = 2; // Time Extention
  390. if( GuiGetCheck(12) ) totalClick = 3; // Alternate Time Projection
  391. if( GuiGetCheck(13) ) totalClick = 3; // fibo Extention
  392. if( GuiGetCheck(14) ) totalClick = 2; // fibo Retracement
  393. if( GuiGetCheck(15) ) totalClick = 5; // Gartley
  394.  
  395.  
  396. ///---------if Left button is Pressed -----------------------------
  397. if( b & 8 AND NOT NotSafeMouseClick) // flag = 8 is set when window just received mouse click
  398. {
  399. x = GetCursorXPosition( 0 ); // X-coordinate in DateTime format. y - value gives PRICE
  400. y = GetCursorYPosition( 0 );
  401. barNo = Lookup( bi, x, 0);
  402.  
  403. if( b & 1 AND barNo >0 )
  404. {
  405. ///////////////////////////////////////////////////////////////////
  406. ////////////////// Fibo Time Extention - 2 Clicks ////////////////
  407. if( GuiGetCheck(11) AND ClickCounter <= totalClick )
  408. {
  409. StaticVarSet( SVFTEx +riFTE + ClickCounter, x,1 ); // DateTime of the bar ...
  410. StaticVarSet( SVFTEy +riFTE + ClickCounter, y,1 );
  411. if( ClickCounter == 1 ) StaticVarSet( SVFTEy+"C" +riFTE + ClickCounter, SelectedValue(C),1 ); // close of the bar
  412. // _TRACE("#, Message ClickCounter= " + ClickCounter + " FTEyc"+ StaticVarGet( SVFTEy+"C" +riFTE + ClickCounter) );
  413.  
  414. StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 ); // Add +1 to ClickCounter
  415. Say( "" + ClickCounter ); Say( "Range " + riFTE,0 );
  416. GuiSetCheck( 21,1 ); // swich ON to show the FTE
  417.  
  418. if( ClickCounter == 2 ) // Once the last mouse Click has occured
  419. {
  420. StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
  421. StaticVarSet( "riFTE", riFTE+1 ); // add plus +1 to RangeIndex Counter
  422. GuisetCheck( 11, 0 ) ; // Reset the button toggle
  423. }
  424. }
  425.  
  426. //////////////////////////////////////////////////////////////////////////
  427. ////////////////// Fibonacci Retracement - 2 Clicks /////////////////////
  428. if( GuiGetCheck(14) AND ClickCounter <= totalClick )
  429. {
  430. StaticVarSet( SVfRetx +riFRET + ClickCounter, x,1 ); // DateTime of the bar ...
  431. StaticVarSet( SVfRety +riFRET + ClickCounter, y,1 );
  432. StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 ); // Add +1 to ClickCounter
  433. Say( "" + ClickCounter ); Say( "Range " + riFRET,0 );
  434. GuiSetCheck( 24,1 ); // swich ON to show the Retracement
  435.  
  436. if( ClickCounter == 2 ) // Once the last mouse Click has occured
  437. {
  438. StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
  439. StaticVarSet( "riFRET", riFRET+1 ); // add plus +1 to RangeIndex Counter
  440. GuisetCheck( 14, 0 ) ; // Reset the button toggle
  441. }
  442. }
  443.  
  444. /////////////////////////////////////////////////////////////////////////////
  445. ////////////////// ATP Alternate Time Projection - 3 Clicks ///////////////
  446. if( GuiGetCheck(12) AND ClickCounter <= totalClick )
  447. {
  448. StaticVarSet( SVatpx +riATP + ClickCounter, x,1 );
  449. StaticVarSet( SVatpy +riATP + ClickCounter, y,1 );
  450. if( ClickCounter == 1 ) StaticVarSet( SVatpy+"C" +riATP+ClickCounter, SelectedValue(C),1 ); // close of the bar
  451. _TRACE("#, Message ClickCounter= " + ClickCounter + " SVatpyC"+ StaticVarGet( SVatpy+"C" +riATP+ClickCounter) );
  452.  
  453. StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 );
  454. Say( "" + ClickCounter ); Say( "Range " + riATP,0 );
  455. GuiSetCheck(22,1);
  456. if( ClickCounter == 3 ) // Once the last mouse Click has occured
  457. {
  458. StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
  459. StaticVarSet( "riATP", riATP+1 ); // add plus +1 to RangeIndex Counter
  460. GuisetCheck(12,0 ) ; // Reset the button toggle
  461. }
  462. }
  463.  
  464. /////////////////////////////////////////////////////////////////////////////
  465. ////////////////// Fibonacci Extention (Expansion) - 3 Clicks //////////////
  466. if( GuiGetCheck(13) AND ClickCounter <= totalClick )
  467. {
  468. StaticVarSet( SVfextx +riEXT + ClickCounter, x,1);
  469. StaticVarSet( SVfexty +riEXT + ClickCounter, y,1 );
  470. StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 );
  471. Say( "" + ClickCounter ); Say( "Range " + riEXT,0 );
  472. GuiSetCheck( 23,1 ); // Click button 23 to show me the lines
  473.  
  474. if( ClickCounter == 3 ) // Once the last mouse Click has occured
  475. {
  476. StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
  477. StaticVarSet( "riEXT", riEXT+1 ); // add plus +1 to RangeIndex Counter
  478. GuisetCheck( 13, 0 ) ; // Reset the button toggle
  479. }
  480. }
  481.  
  482. ///////////////////////////////////////////////////////////////////
  483. ////////////////// Gartley - 5 Clicks ////////////////////////////////
  484. if( GuiGetCheck(15) AND ClickCounter <= totalClick ) // if Button 15 is ON.... and IF ClickCounter is less equal than 5 ( ClickCounter<=5 )
  485. {
  486. StaticVarSet( SVGartleyx +ClickCounter , x,1 );
  487. StaticVarSet( SVGartleyy +ClickCounter , y,1 );
  488. StaticVarset( "ClickCounter" + chartID, ClickCounter + 1 ); // Add +1 to ClickCounter
  489. Say( "" + ClickCounter , 0 );
  490. GuiSetCheck( 25,1 );
  491.  
  492. if( ClickCounter == 5 ) // Once the last mouse Click has occured
  493. {
  494. StaticVarset( "ClickCounter" + chartID, 1 ); // restart the ClickCounter
  495. GuisetCheck( 15, 0 ) ; // Reset the button toggle
  496. }
  497.  
  498. }
  499. }
  500. }
  501.  
  502.  
  503. //////////// TextOut the Next Click or the range /////////////////////////////
  504. // if(DebugOn) _TRACE("#, Message ClickCounter= " + ClickCounter);
  505. if( ( GuiGetCheck(11) OR GuiGetCheck(12) OR GuiGetCheck(13) OR GuiGetCheck(14) OR GuiGetCheck(15)) AND ClickCounter<= totalClick)
  506. {
  507. GfxsetBkMode( 1 ); // 1 set transparent mode
  508. GfxSetTextColor( colorYellow );
  509. GfxSelectFont("Times New Roman", 13, 700, True );
  510. GfxTextOut( " Place " + ClickCounter + " of ( " + totalClick + " Clicks ) ", 100 ,status( "pxchartbottom" )-20);
  511. }
  512.  
  513.  
  514. /////////////////////////////////////////////////////////////
  515. // PART 1 Fibo Time Extension
  516. /////////////////////////////////////////////////////////////
  517. //GfxSetOverlayMode( 1 );
  518. GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
  519.  
  520. for( i = 1; i < nIndex ; i++ )
  521. {
  522. x0 = Lookup(bi,StaticVarGet( SVFTEx + i + "1" )); // return the bar index of the specific datetime
  523. x1 = Lookup(bi,StaticVarGet( SVFTEx + i + "2" ));
  524. y0 = StaticVarGet( SVFTEy + i + "1" );
  525. y1 = StaticVarGet( SVFTEy + i + "2" );
  526. y0C = StaticVarGet( SVFTEy + "C" + i + "1" );
  527. // _TRACE( "# , FTE nIndex " + i );
  528. //-----------------------------------------------------
  529. // Code For Clicks Above or Below Bar - Compare Mouse Position with the (Y0 and Close) of the first Click
  530. if( y0 > y0C ) mousePosition = 1; else mousePosition = 0;
  531. // if( b & 9 ) _TRACE( "#, y0 " + y0 + ", y0C = " + y0C + " mousePosition " + mousePosition );
  532. if( mousePosition ) { TxtPos = 5; fnt = "$"; fntPos = -10; }
  533. else { TxtPos = -15; fnt = "#"; fntPos = -1; }
  534. //-----End --- Code For Above or Below ---------
  535.  
  536.  
  537. if( GuiGetCheck(21) ) // show/ hide the FText lines
  538. {
  539. if( x0 != 0 AND x1 != 0 ) // draw on chart if range is selected
  540. {
  541. Bars = x1 - x0; // printf( "range bars " + bars );
  542. x382 = round(x1 + bars * 0.382);
  543. x50 = round(x1 + bars * 0.5);
  544. X618 = round(x1 + bars * 0.618);
  545. X100 = x1 + Bars;
  546. X1272 = round(x1 + bars * 1.272);
  547. X1618 = round(x1 + bars * 1.618);
  548. x200 = x1 + bars * 2 ;
  549. X2618 = round(x1 + bars * 2.618);
  550. Xs7 = round(x1 + bars * GTxt7 ); // User Value
  551. Xs8 = round(x1 + bars * GTxt8 );
  552.  
  553. color = 33 + i ;
  554. GfxSelectPen( color, 1, 0 );
  555.  
  556. GfxMoveTo( X0, y0 ); GfxLineTo( x1618, y0 ); // Horizontal line - PLOTS AT THE LEVEL OF Y0 = 1st CLICK
  557.  
  558. GfxsetBkMode( 1 ); // 1 set transparent mode
  559. GfxSetTextColor( color ); GfxSetTextAlign( 6 );
  560. //GfxSelectFont( "Arial", 8, 500, 0, 0, 900 ); // vertical fonts
  561. fsize=8; // fontsize
  562. PlotTextSetFont( "FTE:(" + i + ")", "ARIAL", fsize, x0, y0, color, colorDefault, TxtPos );
  563. PlotTextSetFont( "EB:" + bars, "ARIAL", fsize, x1, y0, color, colorDefault, TxtPos );
  564. if (GuiGetCheck(121)) PlotTextSetFont( "38.2%" , "ARIAL", fsize, x382, y0, color, colorDefault, TxtPos );
  565.  
  566. if (GuiGetCheck(123)) PlotTextSetFont( "61.8%" , "ARIAL", fsize, x618-1, y0, color, colorDefault, TxtPos );
  567. if (GuiGetCheck(124)) PlotTextSetFont( "100%" , "ARIAL", fsize, x100-1, y0, color, colorDefault, TxtPos );
  568. if (GuiGetCheck(125)) PlotTextSetFont( "1272%" , "ARIAL", fsize, x1272 - 2, y0, color, colorDefault, TxtPos );
  569. if (GuiGetCheck(126)) PlotTextSetFont( "161.8%" , "ARIAL", fsize, x1618 - 2, y0, color, colorDefault, TxtPos );
  570. // if (GuiGetCheck(46)) PlotTextSetFont( "200%" , "ARIAL", fsize, x200 - 1, y0, color, colorDefault, TxtPos );
  571. if (GuiGetCheck(127)) PlotTextSetFont( "261.8%" , "ARIAL", fsize, X2618 - 1, y0, color, colorDefault, TxtPos );
  572. if (GuiGetCheck(128)) PlotTextSetFont( "261.8%" , "ARIAL", fsize, X2618 - 1, y0, color, colorDefault, TxtPos );
  573.  
  574. if (GTxt7>0) if (GuiGetCheck(129)) PlotTextSetFont( ""+GTxt7+"%" , "ARIAL", fsize, Xs7 - 1, y0, color, colorDefault, TxtPos ); // User Value
  575. if (GTxt8>0) if (GuiGetCheck(130)) PlotTextSetFont( ""+GTxt8+"%" , "ARIAL", fsize, Xs8 - 1, y0, color, colorDefault, TxtPos ); // User Value
  576.  
  577.  
  578. xfonts="Wingdings 3";
  579. PlotTextSetFont( fnt , xfonts, 10, x0, y0, color, colorDefault, fntPos );
  580. PlotTextSetFont( fnt , xfonts, 10, x1, y0, color, colorDefault, fntPos );
  581. PlotTextSetFont( fnt , xfonts, 10, x382, y0, color, colorDefault, fntPos );
  582. PlotTextSetFont( fnt , xfonts, 10, x618, y0, color, colorDefault, fntPos );
  583. PlotTextSetFont( fnt , xfonts, 10, x100, y0, color, colorDefault, fntPos );
  584. PlotTextSetFont( fnt , xfonts, 10, x1272, y0, color, colorDefault, fntPos );
  585. PlotTextSetFont( fnt , xfonts, 10, x1618, y0, color, colorDefault, fntPos );
  586. PlotTextSetFont( fnt , xfonts, 10, x200, y0, color, colorDefault, fntPos );
  587. PlotTextSetFont( fnt , xfonts, 10, x2618, y0, color, colorDefault, fntPos );
  588.  
  589. PlotTextSetFont( fnt , xfonts, 10, Xs7, y0, color, colorDefault, fntPos ); // User Value
  590. PlotTextSetFont( fnt , xfonts, 10, Xs8, y0, color, colorDefault, fntPos ); // User Value
  591.  
  592. }
  593. RemoveOneRangeIndex( 11, 21 , SVFTEx + i + "*", SVFTEy + i + "*" );
  594. }
  595.  
  596. }// end loop
  597. // END Fibo Time Extension
  598. //////////////////////////////////////////////////////////////////////
  599.  
  600.  
  601.  
  602. /////////////////////////////////////////////////////////////
  603. // PART 2 ATP Alternate Time Projection - ratio 100%
  604. /////////////////////////////////////////////////////////////
  605. function UserClickError(x0,x1,x2)
  606. { // Notify the user if the clicks are NOT in series
  607. local x0;x1;x2;
  608. if(x0 > x1 or x0 > x2 or x1 > x2 )
  609. GfxSetCoordsMode( 0 ); GfxsetBkMode( 1 ); GfxSetTextColor( colorred ); GfxTextOut( "ATP, User ERROR: Try again" ,350 , 50 );
  610. }
  611.  
  612. //GfxSetOverlayMode( 1 );
  613. GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
  614.  
  615.  
  616. for ( i =1; i < nIndex ; i++ )
  617. {
  618. x0 = Lookup(bi,StaticVarGet( SVatpx+i+"1" ));
  619. x1 = Lookup(bi,StaticVarGet( SVatpx+i+"2" ));
  620. x2 = Lookup(bi,StaticVarGet( SVatpx+i+"3" ));
  621. y0 = StaticVarGet( SVatpy+i+"1" );
  622. y1 = StaticVarGet( SVatpy+i+"2" );
  623. y2 = StaticVarGet( SVatpy+i+"3" );
  624. y0C = StaticVarGet( SVatpy+"C" + i + "1" );
  625.  
  626. //if( b == 9 ) _TRACE( "#, ATP x0 " + x0 + " x1 " + x1 + " x2 " + x2 );
  627. // _TRACE( "# , ATP nIndex " + i );
  628. //-----------------------------------------------------
  629. // Code For Clicks Above or Below Bar - Compare Mouse Position with the (Y0 and Close) of the first Click
  630. if( y0 > y0C ) mousePosition = 1; else mousePosition = 0;
  631. // if( b & 9 ) _TRACE( "#, y0 " + y0 + ", y0C = " + y0C + " mousePosition " + mousePosition );
  632. if( mousePosition ) { TxtPos = 5; fnt = "$"; fntPos = -10; }
  633. else { TxtPos = -15; fnt = "#"; fntPos = -1; }
  634. //-----End --- Code For Above or Below ---------
  635.  
  636. if (GuiGetCheck(22)) // show/ hide the ATP lines
  637. {
  638. if( x0 != 0 AND x2 != 0 AND x1 != 0 ) // draw on chart if range is selected
  639. {
  640. UserClickError(x0,x1,x2); // Notify the user if the clicks are NOT in series
  641. // _TRACE( "# , ATP nIndex (" + i + " ) GuiGetCheck(22)" + GuiGetCheck(22) );
  642. AB = x1 - x0;
  643. P618 = round( x2 + AB * 0.618 ) ; //61.8%
  644. ATP = x2 + AB ; // AB PROJECTED FROM "C" (bi[x2] ) =100%
  645. P1272 = round(x2 + AB * 1.272) ; //127.2%
  646. P1618 = round(x2 + AB * 1.618) ; //161.8%
  647. P200 = x2 + AB * 2; //200%
  648. P2618 = round(x2 + AB * 2.618) ; //261.8%
  649. Xs7 = round(x2 + AB * GTxt7 ); // User Value
  650. Xs8 = round(x2 + AB * GTxt8 );
  651.  
  652. color = 33 + i ;
  653. GfxSelectPen( color, 1, 0 );
  654. GfxMoveTo( X0, y0 ); GfxLineTo( P2618, y0 ); // Horizontal line - PLOTS AT THE LEVEL OF Y0 = 1st CLICK
  655.  
  656. GfxsetBkMode( 1 ); // 1 set transparent mode
  657. GfxSetTextColor( color ); GfxSetTextAlign( 6 );
  658. //GfxSelectFont( "Arial", 9, 500, 0, 0, 900 ); // vertical fonts
  659. fsize=8; // fontsize
  660. PlotTextSetFont( "ATP:(" + i + ")", "ARIAL", fsize, x0, y0, color, colorDefault, TxtPos );
  661. PlotTextSetFont( "EB:", "ARIAL", fsize, x1, y0, color, colorDefault, TxtPos );
  662. PlotTextSetFont( "FROM" , "ARIAL", fsize, x2, y0, color, colorDefault, TxtPos );
  663. if (GuiGetCheck(143)) PlotTextSetFont( "61.8%" , "ARIAL", fsize, P618, y0, color, colorDefault, TxtPos );
  664. if (GuiGetCheck(144)) PlotTextSetFont( "100%" , "ARIAL", fsize, ATP, y0, color, colorDefault, TxtPos );
  665. if (GuiGetCheck(146)) PlotTextSetFont( "161.8%" , "ARIAL", fsize, P1618, y0, color, colorDefault, TxtPos );
  666. //if (GuiGetCheck(000)) PlotTextSetFont( "200%" , "ARIAL", fsize, P200, y0, color, colorDefault, TxtPos );
  667. if (GuiGetCheck(147)) PlotTextSetFont( "2618%" , "ARIAL", fsize, P2618, y0, color, colorDefault, TxtPos );
  668.  
  669. if (GTxt7>0) if (GuiGetCheck(149)) PlotTextSetFont( ""+GTxt7+"%" , "ARIAL", fsize, Xs7 - 1, y0, color, colorDefault, TxtPos ); // User Value
  670. if (GTxt8>0) if (GuiGetCheck(150)) PlotTextSetFont( ""+GTxt8+"%" , "ARIAL", fsize, Xs8 - 1, y0, color, colorDefault, TxtPos ); // User Value
  671.  
  672.  
  673. xfonts="Wingdings 3";
  674. PlotTextSetFont( fnt , xfonts, 10, x0, y0, color, colorDefault, fntPos );
  675. PlotTextSetFont( fnt , xfonts, 10, x1, y0, color, colorDefault, fntPos );
  676. PlotTextSetFont( fnt , xfonts, 10, x2, y0, color, colorDefault, fntPos );
  677. PlotTextSetFont( fnt , xfonts, 10, p618, y0, color, colorDefault, fntPos );
  678. PlotTextSetFont( fnt , xfonts, 10, ATP, y0, color, colorDefault, fntPos );
  679. PlotTextSetFont( fnt , xfonts, 10, p1272, y0, color, colorDefault, fntPos );
  680. PlotTextSetFont( fnt , xfonts, 10, p1618, y0, color, colorDefault, fntPos );
  681. PlotTextSetFont( fnt , xfonts, 10, p200, y0, color, colorDefault, fntPos );
  682. PlotTextSetFont( fnt , xfonts, 10, p2618, y0, color, colorDefault, fntPos );
  683.  
  684. PlotTextSetFont( fnt , xfonts, 10, Xs7, y0, color, colorDefault, fntPos ); // User Value
  685. PlotTextSetFont( fnt , xfonts, 10, Xs8, y0, color, colorDefault, fntPos ); // User Value
  686.  
  687. }
  688. RemoveOneRangeIndex( 12, 22 , SVatpx+i+"*", SVatpy+i+"*" );
  689. }
  690. }// end index loop
  691.  
  692. // END ATP Alternate Time Projection - ratio 100%
  693. //////////////////////////////////////////////////////////////////////
  694.  
  695.  
  696. /////////////////////////////////////////////////////////////
  697. // PART 3 Fibonacci Extention (Expansion)
  698. /////////////////////////////////////////////////////////////
  699. GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
  700.  
  701. for ( i =1; i < nIndex ; i++ )
  702. {
  703. x0 = Lookup(bi,StaticVarGet( SVfextx+i+"1" ));
  704. x1 = Lookup(bi,StaticVarGet( SVfextx+i+"2" ));
  705. x2 = Lookup(bi,StaticVarGet( SVfextx+i+"3" ));
  706. y0 = StaticVarGet( SVfexty+i+"1" );
  707. y1 = StaticVarGet( SVfexty+i+"2" );
  708. y2 = StaticVarGet( SVfexty+i+"3" );
  709.  
  710. if(GuiGetCheck(23)) // show/ hide the FText lines
  711. {
  712.  
  713. if( x0 != 0 AND x2 != 0 ) // draw on chart if range is selected
  714. {
  715. yRange = ( y1 - y0 ) ;
  716. y_000 = y0 + yRange;
  717. y_038 = y2 + ( yRange * 0.382 ); // 38.2%
  718. y_050 = y2 + ( yRange * 0.500 ); // 50.0%
  719. y_061 = y2 + ( yRange * 0.618 ); // 61.8%
  720. y_078 = y2 + ( yRange * 0.786 ); // 78.6%
  721.  
  722. // if( b == 9 ) _TRACE( "#, ATP y_000= " + y_000 + ", yRange =" + yRange + ", y_050 =" + y_050 );
  723.  
  724. Y_100 = y2+ yRange;
  725. y_112 = y2+( yRange * 1.128 ) ; // 112.8%
  726. y_127 = y2+( yRange * 1.272 ) ; // 127.2%
  727. y_161 = y2+( yRange * 1.618 ) ; // 161.8%
  728. y_261 = y2+( yRange * 2.618 ) ; // 261.8%
  729. Xs7 = y2+( yRange * GTxt7 ); // User Value
  730. Xs8 = y2+( yRange * GTxt8 ) ;
  731.  
  732. color = 33 + i ;
  733. GfxSelectPen( color, 1, penstyle = 1 ); // penstyle: Dash=1, Dot=2
  734. GfxMoveTo( X0, y0 ); GfxLineTo( x1, y1 ); GfxLineTo( x2, y2 ); // wave line 1,2,3
  735.  
  736. // Extentions
  737. GfxSelectPen( colorGreen, 1, penstyle = 2 );
  738. GfxMoveTo( X1, y_038 ); GfxLineTo( x2, y_038 );
  739. GfxMoveTo( X1, y_050 ); GfxLineTo( x2, y_050 );
  740. GfxMoveTo( X1, y_061 ); GfxLineTo( x2, y_061 ); // 61.8%
  741. GfxMoveTo( X1, (y1-y0)+y2 ); GfxLineTo( x2, Y_100 ); // 100.0%
  742. GfxMoveTo( X1, y_112 ); GfxLineTo( x2, y_112 ); // 112.8%
  743. GfxMoveTo( X1, y_127 ); GfxLineTo( x2, y_127 ); // 127.2%
  744. GfxMoveTo( X1, y_161 ); GfxLineTo( x2, y_161 ); // 161.6%
  745. GfxMoveTo( X1, y_261 ); GfxLineTo( x2, y_261 ); // 261.8%
  746. GfxMoveTo( X1, Xs7 ); GfxLineTo( x2, Xs7 ); // User Value
  747. GfxMoveTo( X1, Xs8 ); GfxLineTo( x2, Xs8 );
  748. // text out
  749. GfxsetBkMode( 1 );
  750. GfxSetTextColor( colorGold );
  751. GfxSelectFont( "Arial", 8, 500 );
  752.  
  753. GfxTextOut( "("+i+")", x1 , y1 ); // show range Index
  754. if (GuiGetCheck(162)) GfxTextOut( "38.2%" , x2 , y_038 );
  755. if (GuiGetCheck(163)) GfxTextOut( "50%" , x2 , y_050 );
  756. if (GuiGetCheck(164)) GfxTextOut( "61.8%" , x2 , y_061 );
  757. if (GuiGetCheck(165)) GfxTextOut( "78.6%" , x2 , y_078 );
  758. if (GuiGetCheck(166)) GfxTextOut( "100%" , x2 , y_100 );
  759. if (GuiGetCheck(167)) GfxTextOut( "112.8%", x2 , y_112 );
  760. if (GuiGetCheck(168)) GfxTextOut( "127.2%", x2 , y_127 );
  761. if (GuiGetCheck(169)) GfxTextOut( "161%" , x2 , y_161 );
  762. if (GuiGetCheck(170)) GfxTextOut( "261.8%", x2 , y_261 );
  763.  
  764. if (GTxt7>0) if (GuiGetCheck(172)) GfxTextOut( ""+GTxt7+"%", x2 , Xs7 ); // User Value
  765. if (GTxt8>0) if (GuiGetCheck(173)) GfxTextOut( ""+GTxt8+"%", x2 , Xs8 );
  766. }
  767.  
  768. // Delete specific range index, press Ctrl and then DoubleClick ON the Circle
  769. RemoveOneRangeIndex( 13, 23 , SVfextx+i+"*", SVfexty+i+"*" );
  770. }
  771. } //end index loop
  772. // END Fibonacci Extention (Expansion)
  773. //////////////////////////////////////////////////////////////////////
  774.  
  775.  
  776. /////////////////////////////////////////////////////////////
  777. // PART 4 Fibonacci Retracement
  778. /////////////////////////////////////////////////////////////
  779. GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
  780.  
  781. for ( i =1; i < nIndex ; i++ )
  782. {
  783. x0 = Lookup(bi,StaticVarGet( SVfRetx+i+"1" ));
  784. x1 = Lookup(bi,StaticVarGet( SVfRetx+i+"2" ));
  785. y0 = StaticVarGet( SVfRety+i+"1" );
  786. y1 = StaticVarGet( SVfRety+i+"2" );
  787.  
  788. if( x0 > x1 ) // if right To left
  789. {
  790. x1 = Lookup(bi,StaticVarGet( SVfRetx+i+ "1" ));
  791. x0 = Lookup(bi,StaticVarGet( SVfRetx+i+ "2" ));
  792. y1 = StaticVarGet( SVfRety +i+ "1" );
  793. y0 = StaticVarGet( SVfRety +i+ "2" );
  794. }
  795.  
  796. if(GuiGetCheck(24)) // show/ hide Retracement lines
  797. {
  798. if( x0 != 0 AND X1 != 0 ) // draw on chart if range is selected
  799. {
  800. LineY = ( Y1 - Y0 ) ;
  801. //y0 = Y1;
  802. y382 = Y1 - ( LineY * 0.382 );
  803. y50 = Y1 - ( LineY * 0.50 );
  804. y618 = Y1 - ( LineY * 0.618 ); // 61.8%
  805. y786 = Y1 - ( LineY * 0.786 ); // 78.6%
  806. Y100 = Y0;
  807. y112 = Y1 - ( LineY * 1.128 ); // 1.128
  808. y127 = Y1 - ( LineY * 1.272 ); // 1.272
  809. y161 = Y1 - ( LineY * 1.618 ); // 1.618%
  810. y261 = Y1 - ( LineY * 2.618 ); // 261.8%
  811. y423 = Y1 - ( LineY * 4.236 ); // 423.6%
  812. Ys7 = Y1 - ( LineY * GTxt7 ); // User Value
  813. Ys8 = Y1 - ( LineY * GTxt8 );
  814.  
  815. // temporary show me a line - how the my 2 clicks are conected
  816. GfxSelectPen( colorBlue, 1, penstyle = 1 ); // penstyle: Dash=1, Dot=2
  817. GfxMoveTo( X0, y0 ); GfxLineTo( x1, y1 );
  818. Color= colorBlue;
  819. GfxSelectPen( Color );
  820. Bars= x1 - x0;
  821. if( ParamToggle( "Measuring X & Y ", "No|Yes" )) ext= Bars; else ext= 0;
  822. GfxMoveTo( X0, y1 ); GfxLineTo( X1+ext, y1 ); // 0%
  823. GfxMoveTo( X0, y100 ); GfxLineTo( X1, y100 ); // 100%
  824. // if( ParamToggle( "Show Fibo Retracements? ", "No|Yes" ) )
  825. //{
  826. GfxMoveTo( X0, y382); GfxLineTo( X1, y382 ); // 38.2%
  827. GfxMoveTo( X0, y50 ); GfxLineTo( X1, y50 ); // 50%
  828. GfxMoveTo( X0, y618 ); GfxLineTo( X1, y618 ); // 61.8%
  829. GfxMoveTo( X0, y786 ); GfxLineTo( X1, y786 ); // 78.6%
  830. GfxMoveTo( X0, y112 ); GfxLineTo( X1, y112 ); // 112.8%
  831. GfxMoveTo( X0, y127 ); GfxLineTo( X1, y127 ); // 127%
  832. GfxMoveTo( X0, y161 ); GfxLineTo( X1, y161 ); // 161.8%
  833. GfxMoveTo( X0, y261 ); GfxLineTo( X1, y261 ); // 261.8%
  834. GfxMoveTo( X0, y423 ); GfxLineTo( X1, y423 ); // 423.6%
  835. GfxMoveTo( X0, Ys7 ); GfxLineTo( X1, Ys7 ); // SELECTED (Παίρνοντας τιμές από Στατικές)
  836. GfxMoveTo( X0, Ys8 ); GfxLineTo( X1, Ys8 ); // User Value
  837. //}
  838.  
  839. //if( ParamToggle( "Show Fibo number? ", "No|Yes" ) )
  840. //{
  841. GfxSelectFont( "Tahoma", 8 );
  842. GfxSetBkMode( colorDefault );
  843. GfxSetTextColor( colorBrown );
  844. GfxTextOut( "("+i+")", x0 , y1 ); // show range Index
  845. GfxTextOut( "0%", X1, y1 );
  846. GfxTextOut( "100%", X1, y100 );
  847. GfxSetTextColor( ColorRGB( 100, 200, 100 ) );
  848. if (GuiGetCheck(182)) GfxTextOut( "38.2%", X1, y382 );
  849. if (GuiGetCheck(183)) GfxTextOut( "50%", X1, y50 );
  850. if (GuiGetCheck(184)) GfxTextOut( "61.8%", X1, y618 );
  851. if (GuiGetCheck(185)) GfxTextOut( "78.6%", X1, y786 );
  852.  
  853. GfxSetTextColor( colorBlueGrey );
  854. if (GuiGetCheck(162)) GfxTextOut( "112.8%", X1, y112 );
  855. if (GuiGetCheck(187)) GfxTextOut( "127%", X1, y127 );
  856. if (GuiGetCheck(188)) GfxTextOut( "161.8%", X1, y161 );
  857. if (GuiGetCheck(189)) GfxTextOut( "261.8%", X1, y261 );
  858. if (GuiGetCheck(190)) GfxTextOut( "423.6%", X1, y423 );
  859. if (GTxt7>0) if(GuiGetCheck(191)) GfxTextOut( ""+GTxt7+"%", X1, Ys7 );
  860. if (GTxt8>0) if (GuiGetCheck(192)) GfxTextOut( ""+GTxt8+"%", X1, Ys8 );
  861. //}
  862.  
  863. GfxsetBkMode( colorDefault );
  864. GfxSetTextColor( colorAqua );
  865. if( ParamToggle( "Bars,Change,% ? ", "No|Yes" ) )
  866. { // TrendLine Bars , Change ,Percent
  867. InfoPosition= Y1 + ( LineY * 0.05 );
  868. perc = NumToStr(abs(((y1-y0)/(y0+1e-9 ))*100),1.2);
  869. InfoTxt = "Change: "+abs(LineY)+ ",("+ perc + " % ), Bars: "+ Bars+"";
  870. GfxTextOut( InfoTxt, X0+Bars/4, InfoPosition );
  871. }
  872.  
  873. if( ParamToggle( "Bars between X & Y ", "No|Yes" )) GfxTextOut( "Bars: "+Bars , X0+Bars/3, Y1 );
  874. if( ParamToggle( "Show Gfx Rectangle ", "No|Yes" ) )
  875. {
  876. GfxFillSolidRect( BarCount +3, y112, BarCount +20, y127, color );
  877. // GfxFillSolidRect( BarCount -1, y112, Status("pxwidth")-80, y127, color ); // also with Pixels
  878. // Text inside Rectangle box
  879. GfxSetTextColor( colorGold); GfxSelectFont( "Tahoma", 10 );
  880. GfxTextOut( StrFormat("%g - %g",y112,y127 ), BarCount+11.5, y112+(y127-y112)/2);
  881. }
  882.  
  883. // Delete specific range index, press Ctrl and then Click ON the Circle
  884. RemoveOneRangeIndex( 14, 24 , SVfRety+i+"*", SVfRetx+i+"*");
  885. }
  886. }
  887. } // end index loop
  888. // END Fibonacci Retracement
  889. //////////////////////////////////////////////////////////////////////
  890.  
  891.  
  892. /////////////////////////////////////////////////////////////
  893. // PART 5 Gartley
  894. /////////////////////////////////////////////////////////////
  895. /// @link https://www.youtube.com/watch?v=mBmNQlYFF6M Bat Pattern
  896. /// @link https://www.youtube.com/watch?v=hn8vsw8zoew Gartley Pattern
  897. /// @link https://www.youtube.com/watch?v=2Q3ozkuF17s
  898. GfxSetCoordsMode( 1 ); //1 = bar/price mode (instead of pixel)
  899. xX = Lookup(bi,StaticVarGet( SVGartleyx+"1" ));
  900. xA = Lookup(bi,StaticVarGet( SVGartleyx+"2" ));
  901. xB = Lookup(bi,StaticVarGet( SVGartleyx+"3" ));
  902. xC = Lookup(bi,StaticVarGet( SVGartleyx+"4" ));
  903. xD = Lookup(bi,StaticVarGet( SVGartleyx+"5" ));
  904. yX = StaticVarGet( SVGartleyy+"1" );
  905. yA = StaticVarGet( SVGartleyy+"2" );
  906. yB = StaticVarGet( SVGartleyy+"3" );
  907. yC = StaticVarGet( SVGartleyy+"4" );
  908. yD = StaticVarGet( SVGartleyy+"5" );
  909.  
  910.  
  911. if(GuiGetCheck(25)) // show/ hide the Gartley
  912. {
  913. if( xx != 0 AND xb != 0 ) // draw on chart if range is selected
  914. {
  915. Bars = xa - xx;
  916. LineXA = ( ya - yx ) ;
  917. y000 = yx - LineXA;
  918. y012 = round(ya - ( LineXA * 0.114 )); // 11.4%
  919. y038 = round(ya - ( LineXA * 0.382 )); // 38.2%
  920. //y_050 = yb + ( LineXA * 0.500 ); // 50.0%
  921. y061 = round(ya - ( LineXA * 0.618 )); // 61.8%
  922.  
  923. y127 = Yx - ( LineXA * 0.272 ); // 127.2%
  924. y161 = Yx - ( LineXA * 0.618 ); // 1.618%
  925. y261 = Yx - ( LineXA * 1.618 ); // 261.8%
  926.  
  927. // Conect the Gartley 5 Points
  928. GfxSelectPen( colorBlue ); // penstyle: Dash=1, Dot=2
  929. GfxMoveTo( Xx, yx ); GfxLineTo( xa, ya ); GfxLineTo( xb, yb ); GfxLineTo( xc, yc ); GfxLineTo( xd, yd );
  930. // Label the Gartley 5 Points
  931. GfxsetBkMode( 1 );
  932. GfxSetTextAlign( 6 );
  933. GfxSelectFont( "Arial", 8);
  934. GfxSetTextColor( colorBlueGrey );
  935. GfxTextOut( "X", Xx, yx ); GfxTextOut( "A", Xa, ya ); GfxTextOut( "B " +yb , Xb, yb ); GfxTextOut( "C", Xc, yc ); GfxTextOut( "D", xd, yd );
  936.  
  937. if (GuiGetCheck(35)) // Show retrace
  938. {
  939. // if point B retrace between 38.2 AND 61.8 levels. this gives us a potential Crab Pattern
  940. GfxSelectPen( colorGreen, 1, penstyle = 2 );
  941. if (yb > y061 AND yb < y038) // για κατω Crab
  942. {
  943. GfxSelectPen( colorGreen, 1, penstyle = 2 );
  944. GfxMoveTo( Xa, y038 ); GfxLineTo( xb, y038 );
  945. GfxMoveTo( Xa, y061 ); GfxLineTo( xb, y061 ); // 61.8%
  946. GfxTextOut( "38.2% "+y038 , xb , y038 );
  947. GfxTextOut( "61.8% "+y061 , xb , y061 );
  948. }
  949. // if point C retrace min to 38.2 and max to 11.4 (88.6) Crab Pattern still valid
  950. if( xc != 0) { GfxMoveTo( Xa, y012 ); GfxLineTo( xc, y012 ); GfxTextOut( "11.4%" , xc , y012 ); }
  951. if ( yc < y038 AND yc > y012) GfxTextOut( "NoT Crab" , xc+8 , y012 );
  952. // Crab target
  953. if ( yc > y038 AND yc < y012)
  954. { // παραλληλόγραμμο - parallelogram
  955. GfxFillSolidRect( xb+Bars*1.618 , y127, xc +Bars*1.618, y161, colorBlue);
  956. GfxTextOut( "Crab Target" , xc+Bars , y127 );
  957. }
  958.  
  959. }
  960. // https://learn.tradimo.com/advanced-chart-patterns/gartley-pattern
  961. // RemoveOneRangeIndex( 15, 25 , SVGartleyx+i+"*", SVGartleyy+i+"*");
  962. // to delete the FTE range Hold down Ctrl, then select the Start Bar of the range, show to the user informations how to.
  963. if ( GetAsyncKeyState( 17 ) < 0 ) // if Ctrl Pressed show to the user informations
  964. { XL= Lookup(bi,StaticVarGet( SVGartleyx+"1" ));
  965. if( b & 9 AND xX== SelectedValue( XL)) // delete the range if you select the Start Bar
  966. {
  967. StaticVarRemove(SVGartleyx+i+"*");
  968. StaticVarRemove(SVGartleyy+i+"*");
  969. }
  970. }
  971. }
  972.  
  973. }
  974.  
  975. // END Gartley
  976. //////////////////////////////////////////////////////////////
  977.  
  978.  
  979. /////////////////////////////////////////////////////////////
  980. // PART 10 Horizontal Lines
  981. /////////////////////////////////////////////////////////////
  982.  
  983. /// @link https://forum.amibroker.com/t/help-with-iif-function-in-a-loop-how-to-check-if-the-code-is-efficient/7187/7
  984. // By --- Milosz Mazurkiewicz ---
  985. // minor changes by Anderson Wilson
  986. // GuiButtons added By Panos
  987.  
  988. // Title = " Ctrl + Left Mouse Button on chart --> Select/Clear selected spots | Ctrl + Left Mouse Button on the right axis area --> Delete all spots";
  989. LookBackPeriod = 500;
  990. SetBarsRequired( LookBackPeriod );
  991. IdSet = Name() + Interval() + GetChartID();
  992. ConditionArray = Nz( StaticVarGet( prefix+"ConditionArray" + IdSet ) );
  993. //bi = BarIndex();
  994.  
  995. // MouseButtonPressed = GetCursorMouseButtons();
  996. // CtrlPressed = GetAsyncKeyState( 17 ) < 0 ;
  997. x = GetCursorXPosition( 0 );
  998. // y = GetCursorYPosition( 0 );
  999.  
  1000. if(GuiGetCheck(10))
  1001. {
  1002. x = LastValue( ValueWhen( x == DateTime(), bi ) );
  1003.  
  1004. if( b & 8 ) // LMB --> Select spots
  1005. {
  1006. GuiSetCheck(20,1); // turn ON GuiCheck
  1007. if (GuiGetCheck(10))
  1008. if( x == 0 AND IsEmpty( y ) ) // remove all lines at once clicking on the right axis area
  1009. { ConditionArray = 0; Say("Remove ALL"); }
  1010. else
  1011. if( ConditionArray[x] ) // remove Selected line
  1012. {ConditionArray[x] = 0; Say("0");}
  1013. else
  1014. {ConditionArray[x] = 1; Say("1"); } // Add a line to the chart
  1015. StaticVarSet( prefix+"ConditionArray" + IdSet, ConditionArray, persist = False );
  1016. }
  1017. }
  1018.  
  1019.  
  1020. if(GuiGetCheck(20)) // hide / Show Horizontal Lines
  1021. {
  1022. fvbi = Status( "firstvisiblebarindex" );
  1023. lvbi = Status( "lastvisiblebarindex" );
  1024. pxchr = Status( "pxchartright" );
  1025.  
  1026. //GfxSetZOrder( -1 );
  1027. GfxSelectFont( "Arial Narrow", 9, 700, False );
  1028.  
  1029. Start = Max( 0, fvbi - LookBackPeriod );
  1030. End = Min( lvbi, BarCount - 1 );
  1031.  
  1032. for( i = Start; i <= End ; i++ )
  1033. {
  1034. if( ConditionArray[i] )
  1035. {
  1036. if( C[i] > O[i] ) Color = colorGreen;
  1037. else
  1038. if( C[i] < O[i] ) Color = colorRed;
  1039. else Color = colorBlue;
  1040.  
  1041. Spot = C[i];
  1042. GfxSetCoordsMode( 1 );
  1043. GfxSelectPen( Color, 2 );
  1044. GfxSelectSolidBrush( Color );
  1045. GfxCircle( i, Spot, -5 );
  1046. GfxMoveTo( i, Spot );
  1047. GfxLineTo( lvbi , Spot );
  1048. GfxSetCoordsMode( 2 );
  1049. GfxSetTextColor( Color );
  1050. GfxTextOut( "" + Spot, pxchr + 3, Spot );
  1051. }
  1052. }
  1053. }
  1054. // END Horizontal Lines
  1055. /////////////////////////////////////////////////////////////
  1056.  
  1057. _TRACE( "# , Code end ---------------------- " );
  1058.  
  1059.  
  1060.  
  1061. /*
  1062. //////// FOR intepritation window - show me what statick vars i have until now
  1063.  
  1064. // print the Fibo Time Extension
  1065. "<b> \nFTEx11= " +StaticVarGet( SVFTEx+"11" ) + ",\t FTEy11= " +StaticVarGet( SVFTEy+"11" ) +
  1066. "\nFTEx12= " +StaticVarGet( SVFTEx+"12" ) + ",\t FTEy12= " +StaticVarGet( SVFTEy+"12" ) ;
  1067. "\nFTEx21= " +StaticVarGet( SVFTEx+"21" ) + ",\t FTEy21= " +StaticVarGet( SVFTEy+"21" ) +
  1068. "\nFTEx22= " +StaticVarGet( SVFTEx+"22" ) + ",\t FTEy22= " +StaticVarGet( SVFTEy+"22" ) ;
  1069. "\nFTEx31= " +StaticVarGet( SVFTEx+"31" ) + ",\t FTEy31= " +StaticVarGet( SVFTEy+"31" ) +
  1070. "\nFTEx32= " +StaticVarGet( SVFTEx+"32" ) + ",\t FTEy32= " +StaticVarGet( SVFTEy+"32" ) ;
  1071. "\nFTEyc11= " +StaticVarGet( SVFTEy+"C11" ) + ",\t FTEyc21= " +StaticVarGet( SVFTEy+"C11" ) +
  1072. "\nFTEyc31= " +StaticVarGet( SVFTEy+"C31" ) + ",\t FTEyc41= " +StaticVarGet( SVFTEy+"C41" ) ;
  1073.  
  1074. */
  1075.  
  1076.  
  1077. EncodeColor( colorBlue);
  1078. "\n<b> Read all pending events \n";
  1079. for( i = 0; GuiGetEvent( i, 0 ); i++ )
  1080. {
  1081. id = GuiGetEvent( i, 0 );
  1082. code = GuiGetEvent( i, 1 );
  1083. text = GuiGetEvent( i, 2 );
  1084.  
  1085. printf("\n Id\t" +id + "\nCode \t" +code + "\nText \t" +text + "</b>");
  1086. }
Add Comment
Please, Sign In to add comment