I have 4 different Strategies. It works on 60 minute timeframe. Each hour I need to know about current position profit in each strategy. If current all open positions profit are more than N, then close all open position in these 4 strategies. Is it possible to do? I can't see if we can pass the data from one strategy to another.
Size:
Color:
Anything's possible, but this in particular won't be easy. For the sake of an argument, I'm assuming that you're running 4 strategies in streaming windows on 4 instruments. Further, let's assume you're using Raw Profit mode so that your strategy can actually estimate the profit with accuracy.
If the strategies are all running separately and simultaneously, the problem is passing data from one to the other and then taking action in the same Strategy that has already "finished" running.
In the context of separate Strategy windows in the Wealth-Lab environment, the only way I could envision it is for all Strategies to write their data to a file or global memory, pause (Sleep) in a loop until all other Strategies have finish writing their data for the current bar, detect and read these data from the other Strategies, and then continue processing to close positions, or not. Actually that doesn't sound too hard after all!
Size:
Color:
Thank you! I also think that all I have to do is write sync code. I think it will work OK from Strategy Monitor. But how to test and optimise it?
Sounds like we need one "master" strategy and call other strategies from there. But how to bind specific ticker to strategy in code?
Another way is to combine all these strategies in one. But methods BuyAtMarket can't accept ticker and I can't tell the strategy Buy specific ticker.
Maybe you tell me how to test 4 different strategy simultaneously with data sync?
Size:
Color:
QUOTE:
Each hour I need to know about current position profit in each strategy.
I think it could be possible to get a strategy's performance, even with PosSizer applied. Igor, since you're a programmer the following shouldn't scare you away. ;)
I'd do it like this. First, in your master strategy find all open ChartForms. Using Reflection, the StrategyName property of the TradingSystemExecutor object shall help find your strategies among them. There also are such helpful properties like position sizing info and active position list. Its Performance property contains the actual SystemPerformance/SystemResults. Use SetGlobal or any other way of swapping bits to communicate the child strategy status to it - there you have another exit condition in your child strategies.
QUOTE:
But how to bind specific ticker to strategy in code?
fyi, Wealth-Lab 6.2.x patched version (to be available soon) will bring a new WealthScript property - an ID for each opened Strategy window.
Size:
Color:
On second thought, why the master strategy?
Assuming that each of your Strategies is easily identifiable somehow e.g. different name like "My Strategy 1", "My Strategy 2"..., then any one of them could host the proposed code logic and simply obtain its own SystemPerformance!
Size:
Color:
Try to explain what I want. I have 4 different tickers wich I want to trade at the same time. I want to do 2 things from code:
1. When no open positions in each strategy I put some orders for each ticker. Some orders will go, some - not.
2. Each period I see the profit/loss for each open position. When I see Profit = N, I need to close all the open positions.
If I make 4 strategies, I can't close all open positions for all strategies. Only for strategy that runs.
If I make 1 strategy for all tickers, I can't open and close position for specific ticker. I only can do it for ticker, bounded to strategy.
I need to test it, so I think I need 1 strategy to trade 4 tickers. It's possible to combine all 4 strategies, but I don't know how to set order for specific ticker.
I see that the solution is simple but stucked :(
Size:
Color:
To make all clear here is the simple exaple.
I see on EUR ang GPB current open positions. If both of them don't have any, I set BuyAtMarket for EUR and ShortAtLimit for GBP. If I have any positions I need to know how profitable they are. If Profit > N I close all open positions for EUR and GBP.
Hope it helps.
Size:
Color: