Download MetaTrader 5

Little Help with getting bid price in alert

To add comments, please log in or register
Bryan McAfee
1033
Bryan McAfee  

Hi all, 

I am new at coding and I am having one small issue.

In my alert it is not giving me a 5 decimal place feed back. I am getting a 4 decimal place result.

 

2014.10.29 12:59:00.591 Testalert AUDNZDi,M5: Alert: BUY signal at Bid=0.2239\n Bid=0.2239\n Time=2014.10.29 19:59\n Symbol=AUDNZDi Period=5

 

Code im using is

 

 Alert("BUY signal at Bid=",Bid,"\n Bid=",Bid,"\n Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());

 


 

 


Sergey Dzyublik
4927
Sergey Dzyublik  

DoubleToStr(Bid, 5)

or with digith     DoubleToStr(Bid, Digits)

 

MT4:  DoubleToString, DoubleToStr

MT5: DoubleToString 

Bryan McAfee
1033
Bryan McAfee  
Thank you so much totally missed that.
Bryan McAfee
1033
Bryan McAfee  

I had one last question and I am done with my indicator.

When plotting arrows that pop with my alert I understand how to use iHigh and iLow  to control where the arrows draw.  My question what if I want the arrow (i am using wingding 177 which looks like a snipers scope) to actually just draw at the price my alert was triggered.   So if my alert pops at say .79015 it would draw it there also.  I am making this indi/alert to be able to see at what point my alert is triggered.

Currently im set up using the iHigh and Ilow, 

 arr_up[i]=iLow(Symbol(),0,i);

arr_dn[i]=iHigh(Symbol(),0,i);

 Its funny the stuff I though would be hard to code has not been to rough, but the things I though would be easy are killing me. I have searched thru the MQL documentation also but anly found how to place them above and below.

 Thanks for the help !!

Sergey Dzyublik
4927
Sergey Dzyublik  

For mt4 

1. if you are using same symbol and TF like your current chart:

your variantbetter
 Symbol() _Symbol
0 in iHigh(Symbol(), 0, i)_Period
iHigh(_Symbol, _Period, i)High[i]

2. What you want is easy in runtime (arr_up[i] = Bid) 
But it doesn't work for tester strategy (need  arr_up[i] = Close[0])
But it doesn't work for history data (need rebuild current TF using M1 ..... lot of work) 

To add comments, please log in or register