if((D'6:00:00'<= Time[0]<=D'9:00:00') == true)
D'6:00:00 is six AM of the day you compiled. Not 6 today. Either use StringToTime or:
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum- True = 1 and false = 0 so you get
if( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true )
if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false )
- You should be able to read your code out loud and have it make sense. You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So don't write if(bool == true), just use if(bool) or if(!bool). Code becomes self documenting when you use meaningful variable names, like bool isLongEnabled where as Long_Entry sounds like a trigger price or a ticket number and "if long entry" is an incomplete sentence.
-
double stoploss=NormalizeDouble(Bid-minstoplevel*Point,Digits);
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 and MetaTrader 4 - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 and MetaTrader 4 - MQL4 programming forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 and MetaTrader 4 - MQL4 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 and MetaTrader 4 - MQL4 programming forum
- Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
double takeprofit=NormalizeDouble(Bid+minstoplevel*Point,Digits); //--- place market order to buy 1 lot int ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.1,h,3,
Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. Compute what a PIP is and use it, not points.
How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum-
Check your return codes for errors and report them.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i want to open buylimit or sellimit orders but at specific time only .
example : set buy limit order 1.10001 from 6 am to 9 am only after that cancel the order .
please check the code and give me the right code or correct it , please .