HI, i wanted to find out to run same strategy but on two timeframes.
What i want to make sure there will not be orders from both timeframes at teh same time, like if strategy enters on one timeframe same instrument, strategy on another timeframe and same instrument will not take it..
is this possible? If so how to achieve this conceptually? i know all strategies are independent.
It is possible. You’ll have to create multiple data series for your strategy and have it look at all the data series that you want. When it finds an entry, you can just check the market position like normal. If you are not flat, then don’t allow anymore entries.
i dont undestand.. dataseries is used for adding additional timeframes.
I was looking for solution to have strategy run on two timeframes, lets say one on 30 sec and another on 1 min charts. But if it takes trade on 30 sec chart, i dont want to take same direction trade on 1 min chart.
i dont want to run strategy on one same chart with two different timeframe.. its confusing…
You can do that. You just need to put in guards to check if you have current positions. For example, check if your market position is flat or not. If it’s flat, then you are allowed to check the strategies on the 30 second or 1 minute chart. If either of those triggers an entry then you just no longer check until the position exits. I think what you initially said didn’t make sense to me, because what I would do is use a single chart with multiple data series to trigger the trade. It seems that you want separate charts with the strategy in each. If you want that, a solution could be an event driven approach. For example, you have a service that holds the true market position between the strategy from different charts. If either strategy triggers an entry, you send an event to the service to update the status. What you want is for the strategies to always check the service to see if the position is flat. You want the strategies to update that service. I have some examples here, but you can just create a simple static class for it.
Here is a more basic example, where two indicators communicate with eachother. What you want to do is have it communicate with some service you create and let that service hold the status.