Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://youtu.be/alaxUdSfbrM
- int NumeroVelas=500;
- void OnStart()
- {
- int VelaMasBaja=1;
- int VelaMasAlta=1;
- MqlRates InfoPrecio[];
- ArraySetAsSeries(InfoPrecio,true);
- CopyRates(Symbol(),PERIOD_CURRENT,0,NumeroVelas+1,InfoPrecio);
- for(int i = 1 ; i<=NumeroVelas; i++)
- {
- if(InfoPrecio[i].low < InfoPrecio[(VelaMasBaja)].low)
- VelaMasBaja=i;
- if(InfoPrecio[i].high > InfoPrecio[(VelaMasAlta)].high)
- VelaMasAlta=i;
- }
- ObjectCreate(Symbol(),"1",OBJ_HLINE,0,0,InfoPrecio[VelaMasBaja].low);
- ObjectSetInteger(0,"1",OBJPROP_COLOR,clrYellow);
- ObjectSetInteger(0,"1",OBJPROP_WIDTH,2);
- ObjectCreate(Symbol(),"2",OBJ_HLINE,0,0,InfoPrecio[VelaMasAlta].high);
- ObjectSetInteger(0,"2",OBJPROP_COLOR,clrYellow);
- ObjectSetInteger(0,"2",OBJPROP_WIDTH,2);
- }
- /* Misma forma pero al reves
- #include<Trade\Trade.mqh>
- CTrade trade;
- int NumeroVelas=300;
- int VelaMasBaja=1;
- void OnStart()
- {
- MqlRates InfoPrecio[];
- ArraySetAsSeries(InfoPrecio,true);
- int Data=CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),InfoPrecio); //mirar si es necesario.
- VelaMasBaja=NumeroVelas;
- for(int i = NumeroVelas ; i >= 2; i--)
- {
- if(InfoPrecio[i].low <= InfoPrecio[VelaMasBaja].low)
- VelaMasBaja=i;
- }
- Print("10: ",InfoPrecio[VelaMasBaja].low);
- ObjectCreate(Symbol(),"1",OBJ_HLINE,0,0,InfoPrecio[VelaMasBaja].low);
- ObjectSetInteger(0,"1",OBJPROP_COLOR,clrRed);
- ObjectSetInteger(0,"1",OBJPROP_WIDTH,1);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment