the strategy that trades longs and shorts simultaneously on one account
Author: Lunev
Creation Date: 5/21/2012 9:50 AM
profile picture

Lunev

#1
1. I need to test the strategy that trades longs and shorts simultaneously on one account while the shorts and longs should overlap sometimes. Is it possible to write the code that will close longs and shorts partially or treat them separately using the same or similar logic for both types of positions?2. I tried to test the code with Bollinger bands indicator using standard deviations factor as a optimized parameter in 0.2 increments. But WLD’s rounded parameters readings to integer numbers what is clearly visible in Results Explorer. After I’d entered the parameter value manually (say 2.2) in the code everything was done well (no rounding). Is there any way to avoid that effect in Optimization mode?
profile picture

Eugene

#2
1. Sure you can hold opposite Positions in an instrument at the same time. Some helpful WealthScript techniques to assist:

Splitting a Position into Two
Pyramiding (Adding to position)

Keep in mind that your Strategy should be designed as a multi-position one:

WealthScript Programming Guide: Programming Trading Strategies > Multi-Position Strategies

2. While we have no idea what code did you try to test, we're limited to guesswork. Best guess: calling the .ValueInt() property of StrategyParameter instead of the .Value(). If it didn't help you need to share a code snippet demonstrating the problem you're having.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).