init runs without a tick
no tick, no data...
if a tick comes in while init is called, there maybe data
but overall, this code makes no sense, init is called only once, if the script is activated
You mean when attached, right ?.
Does not matter the codes makes sense or not. All I can say don't assign (yet) predefined variable value on init of separate windows of custom indy.
I agree that init (and de-init) is called once but not sure bout "if a tick comes in while init is called, there maybe data", cause there's assignment on EA's init and I don't know if there's in coming tick or not.
you assign a value, and the value is zero, because there are no data
assign 5 and 6 instead of bid and ask and they will be printed in start
its such easy....
besides of that, bid and ask arent avaiable in indicators.
you can use Close[0] instead sorry, i have forgot this to mention in the earlier posts
you assign a value, and the value is zero, because there are no data
assign 5 and 6 instead of bid and ask and they will be printed in start
its such easy....
There's no assignment of value of predefined variable on init of Custom Indy but there' s on init of EA, that is easy...
I'm talking bout value assignment of predefined variable (see https://book.mql4.com/variables/predefined) on init of custom indy, not talking bout some value assignment.
Rosh, Stringo. Is that really got to do with ICustom (..)?
you assign a value, and the value is zero, because there are no data
assign 5 and 6 instead of bid and ask and they will be printed in start
its such easy....
besides of that, bid and ask arent avaiable in indicators.
you can use Close[0] instead sorry, i have forgot this to mention in the earlier posts
or... MarketInfo(Symbol(), MODE_ASK) &/ MarketInfo(Symbol(), MODE_BID). Ask and Bid are available on the start though but not on init.
Great !!! problem solve w/o any explanation why :).
Thanks 4 the good job, meikel, I should try it with one way or the other.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone,
If you write like this below on custom indicator separate window MT4 build 225 (UK Apari):
double PrevAsk, PrevBid ;
init
{
RefreshRates();
PrevAsk = Ask;
PrevBid = Bid;
Print ("Init PrevAsk = ",PrevAsk," PrevBid = ",PrevBid);
}
start
{
Print ("Start PrevAsk = ",PrevAsk," PrevBid = ",PrevBid);
}
you expect that the prices were assigned to the variables on init part of the indy and expect to see the print out of the price of Ask and Bid on expert log.
But my expert log say "Init PrevAsk = 0 PrevBid = 0" and " Start PrevAsk = 0 PrevBid = 0". It looks like that there's no assignment operator on init part of custom indicator separate windows (I don't know if this is also fail on main window). Therefore the value of variables remain zero.
There no assignment problem on the start though.
I already report to support@metaquotes.net, but they ask me to write to this forum. Looks like they prefer to their new baby MT5 now than MT4.