How to set Positionsize if Short and Sell at the same time in Futures mode

Hi there,

I just start using sigScaleIn/Out/SetPositionSize in my afl program. I'm trading futures which will have to tackle buy/short/sell/cover. I want to buy in a scale in and out mode, but close all buy positions once a sell condition meets. Same for short and cover.
For example, I BUY 5 contracts and sell all of them when SELL condition meets. So I should set the positionsize to 5 when this SELL occurs. But if the SHORT condition meets at the same time as the SELL, then should I setpositionsize to 6 (5+1)? How can I separate the two so that it won't affect SELLPRICE & SHORTPRICE?

Sell and Cover always exit your entire position, so they don't use the PositionSize array. PositionSize is used with the Buy and Short arrays, which includes scale-ins and scale-outs.

2 Likes

Excellent. It helps.

In that case, it would be nice to hit the heart-shaped "like" icon or mark the response as the the solution to your question. Good etiquette will encourage others to help you in the future, and will also make it easier for other forum users to find answers.

3 Likes