# HELP: the order open priceis not the open price of the candle ????

29

hello everybody

i am trying to program an expert advisor using parbolic SAR indicator

and i have some tiny problems that affect the result in a huge way

1- i want the order open price to be exactly the open price of the candle (the problem : there are always delay in opening price)

as you can see in the chart (the price of  BUY order is more than the open price of the candle with 8 points), and sometimes become more and more bigger.

i am using this code for making the order:

double sar1=iSAR(NULL,0,Step,Maximum,1);
double close1=iClose(NULL,0,1);
double sar0=iSAR(NULL,0,Step,Maximum,0);
double close0=iOpen(NULL,0,0);

if((sar1>close1)&& (sar0<close0))

{

}

any body can help me how to fix this problem!!!..

6433

hello everybody

i am trying to program an expert advisor using parbolic SAR indicator

and i have some tiny problems that affect the result in a huge way

1- i want the order open price to be exactly the open price of the candle (the problem : there are always delay in opening price)

as you can see in the chart (the price of  BUY order is more than the open price of the candle with 8 points), and sometimes become more and more bigger.

i am using this code for making the order:

double sar1=iSAR(NULL,0,Step,Maximum,1);
double close1=iClose(NULL,0,1);
double sar0=iSAR(NULL,0,Step,Maximum,0);
double close0=iOpen(NULL,0,0);

if((sar1>close1)&& (sar0<close0))

{

}

any body can help me how to fix this problem!!!..

Check difference Bid and Ask   with weekendtesting you can have you are testing with big spread value

29

deVries:

Check difference Bid and Ask   with weekendtesting you can have you are testing with big spread value

but the difference between Bid and Ask in currencies is 3 points.

why i have big difference?

is there any way to catch the Ask at the beginning of the candle so it will be very close to Open[0] of the candle??

6433

but the difference between Bid and Ask in currencies is 3 points.

why i have big difference?

is there any way to catch the Ask at the beginning of the candle so it will be very close to Open[0] of the candle??

NO your condition for opening is not true that moment
At opening you have still this condition

`sar1>close1   &&  sar0>close0`

when price hits point sar0   sar direction change

and you get condition

`if((sar1>close1)&& (sar0<close0))`

so the trade is not opened at new candle  but the moment sar direction is changed

17084

1. sadik: but the difference between Bid and Ask in currencies is 3 points.

It may be 3 pips or it may be variable depending on the broker. Your broker is a 5 digit broker: a pip is NOT a point. The spread is definitely not 0.3 pips

2. why i have big difference?
You didn't bother to show the prices in your image - we have no idea how far that is. Right click -> properties -> show ask line so you see how big the spread is.
29

deVries:

NO your condition for opening is not true that moment
At opening you have still this condition

when price hits point sar0   sar direction change

and you get condition

so the trade is not opened at new candle  but the moment sar direction is changed

so can you give me a condition that make the trade opened at new candle?
29

WHRoeder:
1. sadik: but the difference between Bid and Ask in currencies is 3 points.

It may be 3 pips or it may be variable depending on the broker. Your broker is a 5 digit broker: a pip is NOT a point.

2. why i have big difference?
You didn't bother to show the prices in your image - we have no idea how far that is. Right click -> properties -> show ask line so you see how big the spread is.

my broker is 4 digits after the point( like 1.2914) for currencies.

and this is the prices.

29

this is another trade with 49 point difference between Buy order and  open price

6433

so can you give me a condition that make the trade opened at new candle?

read my explanation why it is not opened at beginning new candle

if you want it then the trade has to be opened at the next candle

17084

1. sadik: my broker is 4 digits after the point( like 1.2914) for currencies.
Your screen shot shows a price of 1.27916 THAT'S FIVE (5) digits.
Thats 4.9 pips. That's not what you previous said.
sadik: but the difference between Bid and Ask in currencies is 3 points.
3. Turn on the Ask line!
4. When a new candle starts, open your buy at the Ask. That is as close as it will ever be.
29

WHRoeder:
1. sadik: my broker is 4 digits after the point( like 1.2914) for currencies.
Your screen shot shows a price of 1.27916 THAT'S FIVE (5) digits.
Thats 4.9 pips. That's not what you previous said.
sadik: but the difference between Bid and Ask in currencies is 3 points.
3. Turn on the Ask line!
4. When a new candle starts, open your buy at the Ask. That is as close as it will ever be.

thanks for your time, but i am still confused, in the last chart

the candle open price is 1.27916 and the Buy price(Ask) is 1.28401

so there is delay 1.28401-1.27916=485 pips

and what you mean by turning on the Ask line???

and for the same chart, there is no way to open the order at price 1.27916 or close to it????.

thanks again.