Close[0] is everytime the actual closeprice.
you can open an order everytime you want based on this.
this doesnt make sense, but its not my strategy....
you dont understand. the only closetime which exists with a fixed value over a longer time is the closetime of the last bar, Close[1]
that maybe until 1 day back in time or more, depending on your timeframe
Yes, thats clear, but do I have to write
if(!Close[0]) return;
before my opening conditions?
Hi,
sorry but I have to comment or better to explain something to this topic again:
I have an EA how onlly has to look at his buy or sell conditions at the close curse of the actual bar. So for example if the EA is running at the H4-Chart it could only open a new order at 3:59, 7:59, 11:59, 15:59, 19:59, 23:59
I tried it like this, but it doesn't work(here the EA is buying everytime):
if(Bid == Close[0])
OrderSend...
I also tried this, but here the EA doesn't buy anything
if(Time[0] == Close[0])
OrderSend...
So I hope you can understand what I mean and help me!!
Thank you
I think you should read what Ticks are and how candle is created based on ticks.
It is not possible to determine if the tick that we currently have is the last tick of the candle. If we are on H1 chart and there is only one tick during this hour, this will be the Close[0] value. It can be set even on the 00:02, and it still will be the Close value. Of course we can only tell that when the hour had passed and another candle starts. That is extreme situation but it proves that your idea doesn't make sense.
So once again. Close[0] is the ACTUAL PRICE and it is equal to BID.
Now you have two options. You can hardcode values of time in your script. You can wait for CurrentTime = "01:59" or something like that. The second option is to wait for the first tick of the new candle and use Close[1]. You are only one tick behind in this one.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I want to write an EA which only opens an new order at the close price of the candle.
How can I do it?