Looks like there is no MOC order issued after entry order get filled while live trading.
Any ideas?
Any ideas?
Rename
Not enough information to help.
1. trading interval?
2. broker?
1. trading interval?
2. broker?
1. Daily
2. IB (MOC order works just fine when manually issued inside TWS)
Profit Target & Stop Loss orders with Same bar function enabled are also working as expected.
2. IB (MOC order works just fine when manually issued inside TWS)
Profit Target & Stop Loss orders with Same bar function enabled are also working as expected.
After reviewing the code for "Sell Next Bar on the same bar" - there's no way that order will work for live trading because there is no position to sell when the buy at limit order is created for the previous bar.
To get that Build 99 MarketClose Auto-Place functionality, you need to use the "1 Bar in Future" qualifier. And for that, you need a condition - I just made Close > 0 so that it's always true. Give this a try -
Note!
The At Close Processing feature is available only in the Strategy Monitor.
To get that Build 99 MarketClose Auto-Place functionality, you need to use the "1 Bar in Future" qualifier. And for that, you need a condition - I just made Close > 0 so that it's always true. Give this a try -
Note!
The At Close Processing feature is available only in the Strategy Monitor.
Will try in a second!
Edit: No MOC order after the entry order get filled
https://www.wealth-lab.com/Discussion/How-to-buy-at-open-and-sell-at-close-the-same-day-6836
So sending the MOC order right after the entry order does not work?
There is no need for this feature I guess, because there is no information of the partial bar needed.
Edit: No MOC order after the entry order get filled
QUOTE:
After reviewing the code for "Sell Next Bar on the same bar" - there's no way that order will work for live trading because there is no position to sell when the buy at limit order is created for the previous bar.
https://www.wealth-lab.com/Discussion/How-to-buy-at-open-and-sell-at-close-the-same-day-6836
So sending the MOC order right after the entry order does not work?
CODE:
... Backtester.CancelationCode = 1; val = multSource[idx]; _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, val, 0, "Buy " + 0.00 + "% below " + source.Description); PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose); ...
QUOTE:
Note!
The At Close Processing feature is available only in the Strategy Monitor.
There is no need for this feature I guess, because there is no information of the partial bar needed.
QUOTE:It works for the backtest, sure.
So sending the MOC order right after the entry order does not work?
CODE:What are you talking about? I'm just saying you need to use a Condition that will return true in order to use that Qualifier. Pick any condition you want that will do that.
There is no need for this feature I guess, because there is no information of the partial bar needed.
QUOTE:
What are you talking about?
The At Close Processing feature takes the information of the partial future bar (one bar after the signal bar, so it's the real-time bar of today) into account. For sending a MOC order right after the entry order is filled, there is no information of the partial bar needed, same like for Profit Target or Stop Loss orders.
QUOTE:
I'm just saying you need to use a Condition that will return true in order to use that Qualifier. Pick any condition you want that will do that.
Tested and it's not working (for me). Is it working for you?
I'm curious to know how you were able to test the At Close functionality more than 1 hour before the close - because you can't specify "At Close Processing" to run more than 3600 seconds (1 hour) before the close.
(But there is a way to do it, and you're right it didn't work. We'll have to think about it more for this "same bar" strategy.)
(But there is a way to do it, and you're right it didn't work. We'll have to think about it more for this "same bar" strategy.)
QUOTE:
I'm curious to know how you were able to test the At Close functionality more than 1 hour before the close - because you can't specify "At Close Processing" to run more than 3600 seconds (1 hour) before the close.
That's a misunderstanding. I didn't write that I wanted or want to use this feature. I only referred to it because you made the reference in Post #3.
QUOTE:
(But there is a way to do it, and you're right it didn't work. We'll have to think about it more for this "same bar" strategy.)
In the meantime market on next bar close + same bar should be labeled as backtest only.
The same problem was already discussed here:
https://www.wealth-lab.com/Discussion/How-to-buy-at-open-and-sell-at-close-the-same-day-6836
Glitch said:
QUOTE:
Hi rafael,
Here's how you can code a Strategy to exit at market close of the same bar as entry. You just have to issue the sell on the same bar where you issue the buy.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) { indicator = bars.Low; source = new Lowest(((bars.Low >> 1) * 0.988), 2); stop = source * (1.0 - (4.00 / 100.0)); PlotTimeSeries(source, "Lowest", "Price", Color.Blue); PlotTimeSeries(stop, "Lowest Stop", "Price", Color.Red); //StartIndex = 8; } public override void Execute(BarHistory bars, int idx) { PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, source[idx]); PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose); } //private members private TimeSeries indicator, source, stop; } }
Your Response
Post
Edit Post
Login is required