Advertisement
Maurizio-Ciullo

Funzione Tutti-Ptn-BaseCrypto

Aug 11th, 2022 (edited)
1,138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.                                                 //  PtnBaseSaCriptovalute  //
  3.                                                
  4.                         ///////////////////INIZIO CREAZIONE STRUTTURA FUNZIONE EASYLANGUAGE //////////////////////
  5.                         // Creare Una Nuova Funzione Di Tipo Buleano Alla Sua Creazione Atrimenti Non Funziona //
  6.                                  // Inizio Codifica di tutti i pattern base Unger Easylanguage //
  7.  
  8. [Legacycolorvalue = true];
  9.  
  10. input: numeropattern(Numericsimple);
  11. array: definizioneptn[200](false);
  12. var:opend0(0),opend1(0),opend2(0),opend3(0),opend4(0),opend5(0),opend6(0),opend7(0);
  13. var:highd0(0),highd1(0),highd2(0),highd3(0),highd4(0),highd5(0),highd6(0),highd7(0);
  14. var:lowd0(0),lowd1(0),lowd2(0),lowd3(0),lowd4(0),lowd5(0),lowd6(0),lowd7(0);
  15. var:closed0(0),closed1(0),closed2(0),closed3(0),closed4(0),closed5(0),closed6(0),closed7(0);
  16.  
  17. // Valori in parentesi Session: (1=regular session, 0=all sessions), (Number of session ago to reference price (0 = current session).
  18. opend0 = openD(0); //(0,0); "opens day no session"
  19. opend1 = openD(1); //(0,1); "opens day no session"
  20. opend2 = openD(2); //(0,2); "opens day no session"
  21. opend3 = openD(3); //(0,3); "opens day no session"
  22. opend4 = openD(4); //(0,4); "opens day no session"
  23. opend5 = openD(5); //(0,5); "opens day no session"
  24. opend6 = openD(6); //(0,6); "opens day no session"
  25. opend7 = openD(7); //(0,7); "opens day no session"
  26.  
  27. // "CONTINUA FINO A 5 "SETTIMANA BORSISTICA" 7 PER CRIPTOVALUTE"
  28.  
  29. highd0 = highD(0); //(0,0); "highs day no session"
  30. highd1 = highD(1); //(0,1); "highs day no session"
  31. highd2 = highD(2); //(0,2); "highs day no session"
  32. highd3 = highD(3); //(0,3); "highs day no session"
  33. highd4 = highD(4); //(0,4); "highs day no session"
  34. highd5 = highD(5); //(0,5); "highs day no session"
  35. highd6 = highD(6); //(0,6); "highs day no session"
  36. highd7 = highD(7); //(0,7); "highs day no session"
  37. // "CONTINUA FINO A 5 "SETTIMANA BORSISTICA" 7 PER CRIPTOVALUTE"
  38.  
  39. lowd0 = lowD(0); //(0,0); "lows day no session"
  40. lowd1 = lowD(1); //(0,1); "lows day no session"
  41. lowd2 = lowD(2); //(0,2); "lows day no session"
  42. lowd3 = lowD(3); //(0,3); "lows day no session"
  43. lowd4 = lowD(4); //(0,4); "lows day no session"
  44. lowd5 = lowD(5); //(0,5); "lows day no session"
  45. lowd6 = lowD(6); //(0,6); "lows day no session"
  46. lowd7 = lowD(7); //(0,7); "lows day no session"
  47. // "CONTINUA FINO A 5 "SETTIMANA BORSISTICA" 7 PER CRIPTOVALUTE"
  48.  
  49. closed0 = closeD(0); //(0,0); "closes day no session"
  50. closed1 = closeD(1); //(0,1); "closes day no session"
  51. closed2 = closeD(2); //(0,2); "closes day no session"
  52. closed3 = closeD(3); //(0,3); "closes day no session"
  53. closed4 = closeD(4); //(0,4); "closes day no session"
  54. closed5 = closeD(5); //(0,5); "closes day no session"
  55. closed6 = closeD(6); //(0,6); "closes day no session"
  56. closed7 = closeD(7); //(0,7); "closes day no session"
  57. // "CONTINUA FINO A 5 "SETTIMANA BORSISTICA" 7 PER CRIPTOVALUTE"
  58.  
  59.                       // Per i range settimanali delle criptovalute alcuni pattern vanno estesi a 7 vedi video Unger //
  60.  
  61. definizioneptn[1]  = absvalue(opend1-closed1)<0.5*(highd1-lowd1) ;
  62. definizioneptn[2]  = absvalue(opend1-closed5)<0.5*(highd5-closed1) ;
  63. definizioneptn[3]  = absvalue(opend5-closed1)<0.5*(maxlist(highd1,highd2,highd3,highd4,highd5)-(minlist(lowd1,lowd2,lowd3,lowd4,lowd5))) ;
  64. definizioneptn[4]  = ((highd0-opend0)> ((highd1-opend1)*1)) ;
  65. definizioneptn[5]  = ((highd0-opend0)> ((highd1-opend1)*1.5)) ;
  66. definizioneptn[6]  =  ((opend0-lowd0)> ((opend1-lowd1)*1)) ;
  67. definizioneptn[7]  =  ((opend0-lowd0)> ((opend1-lowd1)*1.5)) ;
  68. definizioneptn[8]  =  closed1>closed2 and closed2>closed3 and closed3>closed4 ;
  69. definizioneptn[9]  =  closed1<closed2 and closed2<closed3 and closed3<closed4 ;
  70. definizioneptn[10]  = highd1>highd2 and lowd1>lowd2 ;
  71. definizioneptn[11]  = highd1<highd2 and lowd1<lowd2 ;
  72. definizioneptn[12]  = ((highd0>(lowd0+lowd0*0.75/100))) ;
  73. definizioneptn[13]  = ((highd0<(lowd0+lowd0*0.75/100))) ;
  74. definizioneptn[14]  = (closed1>closed2) ;
  75. definizioneptn[15]  = (closed1<closed2) ;
  76. definizioneptn[16]  = (closed1<opend1) ;
  77. definizioneptn[17]  = (closed1>opend1) ;
  78. definizioneptn[18]  = ((closed1<(closed2-closed2*0.5/100))) ;
  79. definizioneptn[19]  = ((closed1>(closed2+closed2*0.5/100))) ;
  80. definizioneptn[20]  = (highd0>(highd1)) ;
  81. definizioneptn[21]  = (highd1>highd5) ;
  82. definizioneptn[22]  = (lowd0<lowd1) ;
  83. definizioneptn[23]  = (lowd1<lowd5) ;
  84. definizioneptn[24]  = (highd1>highd2) and (highd1>highd3) and (highd1>highd4) ;
  85. definizioneptn[25]  = (highd1<highd2) and (highd1<highd3) and (highd1<highd4) ;
  86. definizioneptn[26]  = ((lowd1<lowd2) and (lowd1<lowd3) and (lowd1<lowd4)) ;
  87. definizioneptn[27]  = ((lowd1>lowd2) and (lowd1>lowd3) and (lowd1<lowd4)) ;
  88. definizioneptn[28]  = (closed1>closed2 and closed2>closed3 and opend0>closed1) ;
  89. definizioneptn[29]  = (closed1<closed2 and closed2<closed3 and opend0<closed1) ;
  90. definizioneptn[30]  = ((highd1-closed1)<0.20*(highd1-lowd1)) ;
  91. definizioneptn[31]  = ((closed1-lowd1)<0.20*(highd1-lowd1)) ;
  92. definizioneptn[32]  = (opend0<lowd1 or opend0>highd1) ;
  93. definizioneptn[33]  = ((opend0<(closed1-closed1*0.5/100))) ;
  94. definizioneptn[34]  = ((opend0>(closed1+closed1*0.5/100))) ;
  95. definizioneptn[35]  = (highd0<highd1 and lowd0>lowd1) ;
  96. definizioneptn[36]  = (highd1-lowd1)<((highd2-lowd2)+(highd3-lowd3))/3 ;
  97. definizioneptn[37]  = (highd1-lowd1)<(highd2-lowd2) and (highd2-lowd2)<(highd3-lowd3) ;
  98. definizioneptn[38]  = (highd2>highd1 and lowd2<lowd1) ;
  99. definizioneptn[39]  = (highd1<highd2 or lowd1>lowd2) ;
  100. definizioneptn[40]  = (highd2<highd1 and lowd2>lowd1) ;
  101. definizioneptn[41]  =  absvalue(opend7-closed1)<0.5*(maxlist(highd1,highd2,highd3,highd4,highd5,highd6,highd7)-(minlist(lowd1,lowd2,lowd3,lowd4,lowd5,lowd6,lowd7))) ;
  102. definizioneptn[42]  = (highd1>highd7) ;
  103. definizioneptn[43]  = (lowd1<lowd7) ;
  104. definizioneptn[44]  = true ;
  105. definizioneptn[45]  = false ;
  106.  
  107.  
  108. PtnBaseSaCrypto = definizioneptn[numeropattern];
  109.  
  110.  
  111.                                     ///////////////////FINE CREAZIONE STRUTTURA FUNZIONE EASYLANGUAGE //////////////////////
  112.                                    
  113.                                    
  114.                                    
  115.                                    
  116.         ///////////////////INIZIO RICHIAMO STRUTTURA FUNZIONE DAL CODICE EASYLANGUAGE CON ESEMPIO STRATEGIA //////////////////////
  117.                          
  118.                          
  119. {Input: MyPtnLY(6), MyPtnSY(4), MyPtnLN(18), MyPtnSN(19);
  120. Input: MyStartTrade(400), MyEndTrade(1330), MyStartPause(1200), MyEndPause(1100);
  121. Input: MyStop(0.011), MyProfit(0.035);
  122. Input: MyNoLongDay(0), MyNoShortDay(0);
  123.  
  124. If time > MyStartTrade And time < MyEndTrade and (Time < MyStartPause or Time > MyEndPause) and PtnBaseSA(1) then Begin
  125.     if PtnBaseSACrypto(MyPtnLY)= True or PtnBaseSACrypto(39) = True and PtnBaseSACrypto(MyPtnLN) = False and Dayofweek(date) <> MyNoLongDay then Begin
  126.     if PtnBaseSACrypto(MyPtnSY)= True or PtnBaseSACrypto(39) = True and PtnBaseSACrypto(MyPtnSN) = False and Dayofweek(date) <> MyNoShortDay then Begin
  127. end;
  128.  
  129. Setstopcontract;
  130. If MyStop > 0 then Setstoploss(MyStop);
  131. If MyProfit > 0 then Setprofittarget(MyProfit);}
  132.                        
  133.  
  134.                           ///////////////////FINE RICHIAMO STRUTTURA FUNZIONE DAL CODICE EASYLANGUAGE CON ESEMPIO STRATEGIA //////////////////////
  135.                          
  136.                          
  137.                          
  138.                            
  139.                ////////////////////////////  Inizio Spiegazione di tutti i pattern base Unger ////////////////////////////
  140.                   /////// Per i range settimanali delle criptovalute alcuni pattern sono stati estesi a 7 vedi video Unger ///////
  141.  
  142.  
  143. // PtnBaseSA1 = // volatility (indecision) // yesterday body < 50% of  range // No Opposite //
  144.  
  145. // PtnBaseSA2 = // volatility (indecision) // open yesterday - close 5 days ago < 50% of (high 5 days ago - close yesterday) // No Opposite //
  146.  
  147. // PtnBaseSA3 = // volatility (indecision) // open of 5 days ago - close of yesterday < 50% of range of last 5 days // No Opposite //
  148.  
  149. // PtnBaseSA3 = // volatility (indecision) // open of 5 days ago - close of yesterday < 50% of range of last 5 days // No Opposite //
  150.  
  151. // PtnBaseSA4 = // directional - up // high to open today so far > high to open of yesterday // Opposite 6 //
  152.  
  153. // PtnBaseSA5 = // directional - up // high to open today so far > 1.5 * (high to open of yesterday) // Opposite 7 //
  154.  
  155. // PtnBaseSA6 = // directional - down // open to low today so far > open to low of yesterday // Opposite 4 //
  156.  
  157. // PtnBaseSA7 = // directional - down // open to low today so far > 1.5 * (open to low of yesterday) // Opposite 5 //
  158.  
  159. // PtnBaseSA8 = // directional - up // 3 consecutive up closes // Opposite 9 //
  160.  
  161. // PtnBaseSA9 = // directional - down // 3 consecutive down closes // Opposite 8 //
  162.  
  163. // PtnBaseSA10 = // directional - up // 2 higher highs and higher lows // Opposite 11 //
  164.  
  165. // PtnBaseSA11 = // directional - down // 2 lower highs and lower lows // Opposite 10 //
  166.  
  167. // PtnBaseSA12 = // expansion // range of today > 0.75% of low of today // Opposite 13 //
  168.  
  169. // PtnBaseSA13 = // compression // range of today < 0.75% of low of today // Opposite 12 //
  170.  
  171. // PtnBaseSA14 = // directional - up // price advanced yesterday // Opposite 15 //
  172.  
  173. // PtnBaseSA15 = // directional - down // price declined yesterday // Opposite 14 //
  174.  
  175. // PtnBaseSA16 = // directional - up // yesterday closed below the open // Opposite 17 //
  176.  
  177. // PtnBaseSA17 = // directional - down // yesterday closed above the open // Opposite 16 //
  178.  
  179. // PtnBaseSA18 = // directional - down // price declined > 0.5% yesterday // Opposite 19 //
  180.  
  181. // PtnBaseSA19 = // directional - up // price advanced > 0.5% yesterday // Opposite 18 //
  182.  
  183. // PtnBaseSA20 = // directional - up // today has traded above yesterday's high // Opposite 22 //
  184.  
  185. // PtnBaseSA21 = // trend - up // yesterday high was above 5-day-ago high // Opposite 23 //
  186.  
  187. // PtnBaseSA22 = // weakness today // today has traded below yesterday's low // Opposite 20 //
  188.  
  189. // PtnBaseSA23 = // trend - down // yesterday low was below 5-day-ago low // Opposite 21 //
  190.  
  191. // PtnBaseSA24 = // trend - up // yesterday high was the highest  in 4 days // Opposite 26 //
  192.  
  193. // PtnBaseSA25 = // not trend up // yesterday high was lowest  in 4 days // Opposite 27 //
  194.  
  195. // PtnBaseSA26 = // trend - down // yesterday low was lowest  in 4 days // Opposite 24 //
  196.  
  197. // PtnBaseSA27 = // not trend down // yesterday low was the highest  in 4 days // Opposite 25 //
  198.  
  199. // PtnBaseSA28 = // trend - up // yesterday close was highest in 3 days and today open is higher // Opposite 29 //
  200.  
  201. // PtnBaseSA29 = // trend - down // yesterday close was lowest in 3 days and today open is lower // Opposite 28 //
  202.  
  203. // PtnBaseSA30 = // strength yesterday // yesterday close was in the top 20% of yesterday range // Opposite 31 //
  204.  
  205. // PtnBaseSA31 = // weakness yesterday // yesterday close was in the bottom 20% of yesterday range // Opposite 30 //
  206.  
  207. // PtnBaseSA32 = // movement // today open gapped either above yest. high or below yest. low //
  208.  
  209. // PtnBaseSA33 = // big gap down // today open is at least 0.5% below yesterday close // Opposite 34 //
  210.  
  211. // PtnBaseSA34 = // big gap up // today open is at least 0.5% above yesterday close // Opposite 33 //
  212.  
  213. // PtnBaseSA35 = // big gap up // today open is at least 0.5% above yesterday close //
  214.  
  215. // PtnBaseSA36 = // volatility contraction // yesterday range < 2/3 (66%) of prior 2-day avg. range // No Opposite //
  216.  
  217. // PtnBaseSA37 = // volatility contraction // yesterday was second consecutive range contraction day // No Opposite //
  218.  
  219. // PtnBaseSA38 = // volatility contraction // yesterday was an inside day // No Opposite //
  220.  
  221. // PtnBaseSA39 = // volatility contraction // yesterday was not an outside day // Opposite 40 //
  222.  
  223.  //PtnBaseSA40 = // volatility expansion // yesterday was an outside day // Opposite 39 //
  224.  
  225.  //PtnBaseSA41 = // volatility (indecision) // open of 7 days ago - close of yesterday < 50% of range of last 7 days // No Opposite //
  226.  
  227.  //PtnBaseSA42 = // trend - up // yesterday high was above 7-day-ago high // Opposite 43 //
  228.  
  229.  //PtnBaseSA43 = // trend - down // yesterday low was below 7-day-ago low // Opposite 42 //
  230.  
  231. // PtnBaseSA44 = true // boolean // true // Opposite 45 //
  232.  
  233. // PtnBaseSA45 = false // boolean // false // Opposite 44 //
  234.  
  235.  
  236.                ////////////////////////////  Fine Spiegazione di tutti i pattern base Unger ////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement