You have to be really lucky to get a DT with totally equal hights.
Better you define a range for the values.
- eddie: You have to be really lucky to get a DT with totally equal hights.They won't be exact, not even close, and even if they were you still have to handle: The == operand. - MQL4 forum
if( iHigh(NULL,PERIOD_D1,1)- iLowest(NULL,PERIOD_H1,MODE_LOW,i,6)>0.2*ATRd) return(true); else return(false);
is if(condition) return true; else return false;
same as if(condition) return condition;
sam as return condition;
Simplify your code. return iHigh(NULL,PERIOD_D1,1)- iLowest(NULL,PERIOD_H1,MODE_LOW,i,6)>0.2*ATRd;
- iLowest does not return a price.What do you think 1.2345 - 5 means?
WHRoeder:
- eddie: You have to be really lucky to get a DT with totally equal hights.They won't be exact, not even close, and even if they were you still have to handle: The == operand. - MQL4 forum
is same as sam as Simplify your code. - iLowest does not return a price.What do you think 1.2345 - 5 means?
Huge thanks, I have corrected the code according to ur suggestions. Now it seems that finally working :))
bool DT () { int i; double ATRd = iATR(Symbol(),1440,14,0); for (i=1; i<40;i++) { if(iHigh(NULL,PERIOD_D1,1)== iHigh(Symbol(),PERIOD_H1, NormalizeDouble(iHighest(NULL,PERIOD_H1,MODE_HIGH,i,6),0) ) ) { return iHigh(NULL,PERIOD_D1,1)- iLow(Symbol(),PERIOD_H1, NormalizeDouble(iLowest(NULL,PERIOD_H1,MODE_LOW,i,0),0) ) > prAtrDTDB*ATRd; }} // prAtrDTDB - extern var
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 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 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 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
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
Hi all
I trying to code the condition of finding DT. I want to check previous 40 bars starting from 6th bar to find the one(H1) with max equals to previous d1 bar.Then I want to check if neck of double bottom is over 20% of average daily range
if conditions are met return True.
Plz help