Hi & lo error

 

Hi all

i want to get highest and lowest price of day before

i use

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 1));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 1, 1));

and tried

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 0));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 1, 0));

getting same reults

it reads yesterday open and close, and all trades are OP_BUY !!!

if ( Ask>HH) BUY="true";
if (Bid<LL ) SELL="true";

----------------------------

if i use

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 0, 1));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 0, 1));

if ( Ask>HH) BUY="true";
if (Bid<LL ) SELL="true";

it reads yesterday open and close, and all trades are OP_SELL !!!

please where is the error?

need your help

Thanks

 
samirgham:

Hi all

i want to get highest and lowest price of day before

i use

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 1));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 1, 1));

and tried

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 0));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 1, 0));

getting same reults

it reads yesterday open and close, and all trades are OP_BUY !!!

if ( Ask>HH) BUY="true";
if (Bid<LL ) SELL="true";

----------------------------

if i use

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 0, 1));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 0, 1));

if ( Ask>HH) BUY="true";
if (Bid<LL ) SELL="true";

it reads yesterday open and close, and all trades are OP_SELL !!!

please where is the error?

need your help

Thanks

iHighest returns the SHIFT, not the value. So you should set HH like this : HH= iHigh(NULL,PERIOD,iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 0));

 
Jacques366 wrote >>

iHighest returns the SHIFT, not the value. So you should set HH like this : HH= iHigh(NULL,PERIOD,iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 0));

Hi Jacques

no changement

still reading yesterday open and close

and still all trades OP_BUY only

Thanks

 
samirgham:

Hi Jacques

no changement

still reading yesterday open and close

and still all trades OP_BUY only

Thanks

HH= iHigh(NULL,PERIOD,iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 0));

HH = Highest value of the highest candle or bar from now to 1 bar, timeframe = D1). If you got yesterday value, that's may be what you're asking for.

read carefully the instrction parameters definition, and rethink your instruction to align it with what you want.

what the currency pair are you on?

 
Jacques366 wrote >>

HH= iHigh(NULL,PERIOD,iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 0));

HH = Highest value of the highest candle or bar from now to 1 bar, timeframe = D1). If you got yesterday value, that's may be what you're asking for.

read carefully the instrction parameters definition, and rethink your instruction to align it with what you want.

what the currency pair are you on?

EUR/USD pair

it is still reading current time price.

the object is

to open BUY trade when the current price >highest price of yesterday

and

to open sell when current price < lowest price of yesterday.

Thanks

NB: if it will take some of your time, NO problem you can forget it, i appreciate your replies..

 
double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 1));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 1, 1));
Should read:
double HH= High[iHighest(NULL,PERIOD_D1,MODE_HIGH,1,1)];
double LL=Low[iLowest(NULL,PERIOD_D1,MODE_LOW,1,1)];
 
Kengen wrote >>

d

i tried

double HH= High[iHighest(NULL,PERIOD_D1,MODE_HIGH,1,1)];

double LL=Low[iLowest(NULL,PERIOD_D1,MODE_LOW,1,1)];
it works for highest and lowest, but open trades randomly, sometimes skip 4 bars without trading, then skip more than 20 bars, then skip 8 bars,....

when i try

double HH= (iHighest(NULL, PERIOD_D1, MODE_HIGH, 1, 1));
double LL=(iLowest(NULL, PERIOD_D1, MODE_LOW, 1, 1));

it trades every bar as programmed, but reads open and close, and continuos BUY for all trades,

anyhow, i will not think about it anymore.

Thanks for your help

Reason: