XavierAndreu

Máximo Mínimo

Apr 8th, 2022
1,209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. //https://youtu.be/alaxUdSfbrM
  2.  
  3. int NumeroVelas=500;
  4.  
  5. void OnStart()
  6. {
  7. int VelaMasBaja=1;
  8. int VelaMasAlta=1;
  9.  
  10. MqlRates InfoPrecio[];
  11. ArraySetAsSeries(InfoPrecio,true);
  12. CopyRates(Symbol(),PERIOD_CURRENT,0,NumeroVelas+1,InfoPrecio);
  13.  
  14. for(int i = 1 ; i<=NumeroVelas; i++)
  15. {
  16. if(InfoPrecio[i].low < InfoPrecio[(VelaMasBaja)].low)
  17. VelaMasBaja=i;
  18.  
  19. if(InfoPrecio[i].high > InfoPrecio[(VelaMasAlta)].high)
  20. VelaMasAlta=i;
  21. }
  22.  
  23. ObjectCreate(Symbol(),"1",OBJ_HLINE,0,0,InfoPrecio[VelaMasBaja].low);
  24. ObjectSetInteger(0,"1",OBJPROP_COLOR,clrYellow);
  25. ObjectSetInteger(0,"1",OBJPROP_WIDTH,2);
  26.  
  27. ObjectCreate(Symbol(),"2",OBJ_HLINE,0,0,InfoPrecio[VelaMasAlta].high);
  28. ObjectSetInteger(0,"2",OBJPROP_COLOR,clrYellow);
  29. ObjectSetInteger(0,"2",OBJPROP_WIDTH,2);
  30. }
  31.  
  32.  
  33. /* Misma forma pero al reves
  34. #include<Trade\Trade.mqh>
  35. CTrade trade;
  36.  
  37. int NumeroVelas=300;
  38. int VelaMasBaja=1;
  39.  
  40. void OnStart()
  41. {
  42. MqlRates InfoPrecio[];
  43. ArraySetAsSeries(InfoPrecio,true);
  44. int Data=CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),InfoPrecio); //mirar si es necesario.
  45.  
  46.  
  47. VelaMasBaja=NumeroVelas;
  48.  
  49. for(int i = NumeroVelas ; i >= 2; i--)
  50. {
  51. if(InfoPrecio[i].low <= InfoPrecio[VelaMasBaja].low)
  52. VelaMasBaja=i;
  53. }
  54.  
  55. Print("10: ",InfoPrecio[VelaMasBaja].low);
  56.  
  57. ObjectCreate(Symbol(),"1",OBJ_HLINE,0,0,InfoPrecio[VelaMasBaja].low);
  58. ObjectSetInteger(0,"1",OBJPROP_COLOR,clrRed);
  59. ObjectSetInteger(0,"1",OBJPROP_WIDTH,1);
  60.  
  61. }
  62. */
Advertisement
Add Comment
Please, Sign In to add comment