Higher high / Lower low
This didn't work; only works when if(Bid>=Lowenterfinalfm)
ronaldosim,
it seemed to work if I use it on its own, is when i combine the 2 filters that it refuses to work.
I am not sure what you are pointing out to me? please clarify for me, thank you.
ronaldosim,
it seemed to work if I use it on its own, is when i combine the 2 filters that it refuses to work.
I am not sure what you are pointing out to me? please clarify for me, thank you.
When I tried yr original code using only one filter
if(Bid<=Lowenterfinalfm)
it didnt work
But when I reverse it
if(Bid>=Lowenterfinalfm)
it works.
When I tried yr original code using only one filter
if(Bid<=Lowenterfinalfm)
it didnt work
But when I reverse it
if(Bid>=Lowenterfinalfm)
it works.
Ok I understand but that just makes it stranger, because there is nothing that should prevent the EA taking a short trade if Bid is lower or equal to 8pips lower than the lowest low of the last 2 15min candles....
The filter should make sure that Bid price is lower or equal to the value of Lowenterfinalfm
Lowenterfm = lowest low of last 2 15min candles -8pips.
Any body have an idea how to fix this?
Hi Rory,
I think your problem is in this line. What you're doing is looking at the low of bars 0 & 1. The problem is bid can't be lower than the low of bar 0 because as the price goes down so does the Low value of that bar. Try changing it to this:
double lowfm=Low[iLowest(NULL,0,MODE_LOW,2,1)];
This will look at bars 1 & 2 (the last two bars - previous to the one you're in now). I didn't look at the rest, but this jumped out at me. Give it a try. Hopefully that's your problem.
Good Luck,
Tovan
Hi Rory,
I think your problem is in this line. What you're doing is looking at the low of bars 0 & 1. The problem is bid can't be lower than the low of bar 0 because as the price goes down so does the Low value of that bar. Try changing it to this:
double lowfm=Low[iLowest(NULL,0,MODE_LOW,2,1)];
This will look at bars 1 & 2 (the last two bars - previous to the one you're in now). I didn't look at the rest, but this jumped out at me. Give it a try. Hopefully that's your problem.
Good Luck,
Tovan
Good catch!
Good catch!
Wow yes Ronaldosim is right, thats a really good catch! thanx Tovan, I will try that.
Hi Rory,
I think your problem is in this line. What you're doing is looking at the low of bars 0 & 1. The problem is bid can't be lower than the low of bar 0 because as the price goes down so does the Low value of that bar. Try changing it to this:
double lowfm=Low[iLowest(NULL,0,MODE_LOW,2,1)];
This will look at bars 1 & 2 (the last two bars - previous to the one you're in now). I didn't look at the rest, but this jumped out at me. Give it a try. Hopefully that's your problem.
Good Luck,
Tovan
Tovan,
it a BREAKTHROUGH!!! thank you! such a small adjustment and now it gives me a "ordersend error 130" but that is fantastic as I can fix that by messing with the values of the TP, SL or order entry price....that's just a bit of math I have to do ...but I am really happy cos the error code means its now trying to send orders...
thanks for the direction.
Thanks Ronaldosim for your help as well.
Hi there,
can any one help me please.... I want to filter a trade entry like this :
1: If the Bid price is lower than or equal to the low on the last hourly candle &&
2: If the Bid price is lower than or equal to the lowest low of the last two 15min candles -8pips
then enter short...
I coded it like this...
int BeyondLow=8; // 8 pips beyond the low
int pip=1;
double lowfm=Low[iLowest(NULL,0,MODE_LOW,2,0)]; // lowest low of last two 15min candles
double Lowenterfm = lowfm-BeyondLow*Point*pip; // value of the lowest low of last two 15min candles -8pips
double Lowenterfinalfm =NormalizeDouble(Lowenterfm,Digits); // make value usable to open trades with -- Bid must be lower or equal to this.
double hourlylow = iLow(Symbol(),PERIOD_H1,1); // Last hourly candle low -- Bid must be lower than or equal to this
if(Bid<=hourlylow&&Bid<=Lowenterfinalfm)
{
MessageBox("Bid is Lower than 2 candle low");
}
This works fine, but when I remove the messagebox function and replace it with an ordersend function it wont work!
It is not a problem with the stoploss or orderopenprice or tp values as I have a getlasterror function to tell me if this is the problem but
the values are fine cos I get no error codes...The EA just will not trade...But if I remove just one of the filters it trades...
for e.g.
If I do this :
if(Bid<=hourlylow)
{
OrderSend(.....) // this works no problem
}
or if I do this :
if(Bid<=Lowenterfinalfm)
{
OrderSend(...) //This also works no problem
}
But if I put the 2 filters together like this :
if(Bid<=hourlylow&&Bid<=Lowenterfinalfm)
{
OrderSend(....) // This now does not work for some reason!!!
}
I don't understand it, I have seen many cases where the charts show the bid price can fulfill both filters.
I have added the EA in case you need to see it to help me...
Thanks in advance