Hi I do have a good background in trading, but I cant figure this problem out for the life of me. All I am basically trying to do is have an 'always in' system that can handle opening and closing it damn trades.
if (first trade) {
if (trend up)
buy
else
sell
}
if (trend changes up)
close previous trade
buy
else if (trend changes down)
close previous trade
sell
I am having alot of difficulty with this whole 'ticket' concept. How can I refer to a specific trade and say if its open close it!
Any help would be appreciated,
thanks
You can access existing orders in a number of ways.
If you need to close all open orders (or if you only ever have 1 open order), then you can find out the number of open orders and turn the result into a loop which closes each order. Remember to subtract 1 because the order numbers are indexed starting at 0. Also remember to check that the orders relate to the appropriate symbol.
If you need to refer to specific orders in a collection of open orders, then you should use the 'magic numbers' facility when opening the order, so that you can identify it in order to modify or close it.
- 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 do have a good background in trading, but I cant figure this problem out for the life of me. All I am basically trying to do is have an 'always in' system that can handle opening and closing it damn trades.
if (first trade) {
if (trend up)
buy
else
sell
}
if (trend changes up)
close previous trade
buy
else if (trend changes down)
close previous trade
sell
I am having alot of difficulty with this whole 'ticket' concept. How can I refer to a specific trade and say if its open close it!
Any help would be appreciated,
thanks