Hi All,
I’m new to the forum.
I want to write logic where a trade executes based off points change from close price – i.e. if the ASX is 30 points up after the close, execute (along with other params).
Can someone help/point me in the right direction to code this?
Thanks
Darren
If you want to place orders at market then you have to tell us what CLOSE you want to use as a reference, yesterday, 9am or which one?
If you want to place pending orders, then you can write (long trade):
Buy 1 contract at close + 30 * pipsize Stop
Please update your Country flag in your profile.
Thank you.
Thanks Roberto, in this case, its 4pm sydney time. And I will update my flag, thanks.
You can save the current price, then place the following order:
If time = 040000 then
EntryPrice = close + 30 * pipsize
Endif
If close > EntryPrice then
Buy 1 contract at market
Endif
I assume in Sydney it’s 4am now.
If you want to buy above or below yesterday market close value you can use DClose(1)
if close >= (DClose(1) + 30) then
Buy 1 contract at market
endif
Note: In the example above I use 30, but depending on the instrument you are trading that number might be 0.30
Hope this helps
Note: In the example above I use 30, but depending on the instrument you are trading that number might be 0.30
good, we could also make it universal by multiplying 30 with the pipsize value of the current instrument:
if close >= (DClose(1) + 30*pipsize) then
Buy 1 contract at market
endif
Sorry been away. Thanks for the reply
Please update your Country flag in your profile.
Thank you.