SellAtMarket and CoverAtMarket are not generating orders (Trade-Ideas)
Author: Frank1972
Creation Date: 12/29/2016 3:50 PM
profile picture

Frank1972

#1
Hi,

I have strategy running in a Streaming Strategy Window configured for 1 minute and trading during the day. When the strategy calls BuyAtLimit or ShortAtLimit I see an alert generated and can transition that alert to the orders page. However, when my strategy calls SellAtMarket or CoverAtMarket I do not see an alert and thus cannot transition it to the orders page. I'm not sure what I am doing wrong or what configuration I may be missing.

Here is what I know:
When the BuyAtLimit(bar + 1, price) call is made I do see a position show up in the ActivePositions array. When the SellAtMarket(bar + 1) call is made it returns true and does remove the position from ActivePositions array but I don't see an alert in the alerts window.

Any assistance that you can provide will be greatly appreciated.

Thanks,

-Frank
profile picture

Eugene

#2
Hi Frank,

Is your question any different from this?

How does a position get into the ActivePositions array?
profile picture

Frank1972

#3
Eugene,

Thanks for the quick reply. In the link you provided I wasn't processing all bars in the bar for loop. I was only processing on the last bar. I am no longer doing this and positions are showing up as expected in the ActivePositions array. My question is different. Let me ask it this way:

If I call SellAtMarket(bar + 1) should I expect an alert to show up in the Alerts Window?

Thanks,

-Frank
profile picture

Eugene

#4
Yes, I'd expect that. What position sizing are you using?
profile picture

Frank1972

#5
Eugene,

I am not seeing alerts come in after I call SellAtMarket(bar + 1) on all 6 positions so far today. Every position gets an alert when BuyAtLimit is called but no alert comes through when I call SellAtMarket(bar + 1).

Not sure why a position sizer would be referenced in closing a position. I am using "Raw Profit Mode" set to a 100 shares for every position so that I can make sure that my strategy is working as expected first before I introduce my custom position sizing algorithm.

Is there something that I can do to help you debug this?

Thanks,

-Frank
profile picture

Eugene

#6
Frank, I'd start with a brief code example demonstrating the anomaly.
profile picture

Frank1972

#7
Eugene,

I think I have figured this out. This has to do with my trading strategy getting orders from an external source, Trade-Ideas. The time that the exit comes in is set on their side and I was taking that time, in milliseconds, and using that to determine when to execute it. As it turns out their time on their exit is set to be 1 or 2 minutes previous to the current bar. So when the exit comes in it is executed 1 or 2 bars prior to the latest one and thus no alert would be sent.

Thanks for your continued help in getting my strategy up and working.

-Frank
profile picture

Eugene

#8
Glad you have sorted this out yourself. They may be using the start-of-bar time whereas Wealth-Lab always uses end-of-bar notation to mark bars.
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).