- ago
Is it possible to simulate MOC entry ideas using "blocks"?
1
526
Solved
8 Replies

Reply

Bookmark

Sort
- ago
#1
PowerPack has Buy Market on Close and Sell Market on Close Blocks.
0
- ago
#2
Thanks, I see buy/sell next bar at market close. I don't see buy the current bar at the closing price?
Am I missing something?
0
Glitch8
 ( 7.81% )
- ago
#3
No you’re not missing anything, we don’t have and Blocks that can enter or exit on the same bar as the one being analyzed.
0
Glitch8
 ( 7.81% )
- ago
#4
Since the WL8 PlaceTrade always operates on the following bar, the way you can model a sell at the close of the "current" bar is to peek one bar into the future in a C# coded strategy. So, for example, if the RSI(30) of idx+1 is greater than 60, issue a PlaceTrade MarketClose exit.

We don't have a way currently to do this in Blocks, but an idea I had is to make a Qualifier letting you look at the next bar's data, specifically for this purpose. If we decide to add this Qualifier we'd need to take care to make sure it isn't ever used in the Genetic Evolver.

1
Best Answer
- ago
#5
Alrighty, Thanks...
0
- ago
#6
QUOTE:
Is it possible to simulate MOC entry ideas using "blocks"?

This has been a FAQ: How can my strategy from Blocks enter or exit at close?

And here's a small subset of duplicate topics for "MOC using blocks" that suggest a minor C# code tweak to accomplish:
https://www.wealth-lab.com/Discussion/Possible-to-Buy-at-Open-and-Sell-at-Close-of-same-bar-7625
0
MIH8
- ago
#7
Hello everybody.

The code solution i use for this purpose looks like that.
CODE:
if (!HasOpenPosition(bars, PositionType.Long)) {             Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0,"MKT");             PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose, 0,"SELL"); }




You can place the MarketClose order directly after the buy. This ensures that it will be executed at the same index (candle) In a Block this can be then an option button in a "Buy" (or Short) Block. I am not aware of any disadvantages with this solution.
0
MIH8
- ago
#8
Some additional comments on my last post. The solution avoids including the future idx+1, which addresses some of the following points.

1. data gaps
2. singnals at the last bar (last available idx) of the data must be treated cleanly.
3. It is also unclear to me how live trading conditions with idx + 1 behave. (the last bar)

I wish you all a nice Sunday
0

Reply

Bookmark

Sort