Hello, I have a quick question, I hope you can help me. I trade Forex with OANDA.
I have two different strategies trading the same symbol, but I don't want both of them opening orders at the same time.
So, if one strategy gets a signal it will only enter an order if the other strategy doesn't have an open order already on that same symbol. And the same the other way around.
How can I code on both of them not to send orders if the other one already has an open order on the same symbol?
Is it with Marketposition_at_Broker maybe?
Thank you,
Ed
Avoiding two strategies trading the same symbol at the same time [SOLVED]
- Vlada MultiCharts
- Posts: 293
- Joined: 22 Apr 2020
- Has thanked: 8 times
- Been thanked: 76 times
Re: Avoiding two strategies trading the same symbol at the same time
Hello Eduardo,
Your idea is right, you can use MarketPosition_at_Broker.
It returns a numeric value that reflects the number of contracts and the type of position at the broker for a particular symbol.
A positive value means long position and a negative value designates a short position.
For example:
Your idea is right, you can use MarketPosition_at_Broker.
It returns a numeric value that reflects the number of contracts and the type of position at the broker for a particular symbol.
A positive value means long position and a negative value designates a short position.
For example:
Code: Select all
if MarketPosition_at_Broker <= 0 then
begin
///condition
buy next bar market;
end;