Comments for https://ctrader.com/products/2600
Comments for: https://ctrader.com/products/2600
- AIn reply tosystem⬆:artscj
Hey,
I like the logic of your cbot, but because I use the 1-minute OR, I scalp on the 1-minute timeframe. As a result, because during high volatility, there is often no retracement back to the OR breakout level, and consequently, the Limit orders are not triggered.
Is it possible to add the parameter option of placing a Sell Stop order or Buy Stop order at or above the OR breakout price level?
This would be very helpful
Many thanks for considering my request.
Cheers
Chris
Here is a modified version of the code: https://ctrader.com/products/2635?u=tarantella
key differences between the new code and the older code
The new code is significantly more advanced and robust.
- ORB High/Low Detection (Crucial Fix)
Old Code (Incremental): It checked _orbHigh and _orbLow bar-by-bar as they happened. If you restarted the robot in the middle of the ORB period, or if a tick was missed, the High/Low would be wrong.
New Code (Retrospective): It uses the new function CalculateORBLevels(). It waits for the ORB period to finish, then scans the historical bar data to find the absolute highest top wick and lowest bottom wick with 100% accuracy, even if you started the robot late.
- Order Types
Old Code: Only supported Limit Orders (waiting for price to come back).
New Code: Supports both Stop Orders (Breakout) and Limit Orders. You can select this in the settings menu.
- Dynamic Slippage & Volatility Handling
Old Code: Calculated SL and TP prices before the trade opened. If the market gapped or slipped during entry, your SL might be too tight or too loose relative to the chart structure.
New Code: Includes a specific logic block inside OnPositionOpened. As soon as a trade fills, it checks the actual execution price, measures the distance to the opposite ORB line, and updates the SL and TP to be mathematically perfect based on the actual fill price.
- Immediate Reversal Logic
Old Code: Did not have reversal logic.
New Code: Has specific logic for Stop Orders. If a Buy Stop is filled, it immediately places a Sell Stop at the bottom (and vice versa). This allows you to catch the move if the first breakout is a "fake-out" and reverses.
- Re-Entry Logic ("Retrace to Mid")
Old Code: The "Retrace to Mid" logic was hard-coded specifically for Limit orders.
New Code: The "Retrace to Mid" logic is now global. Whether you use Stop or Limit orders, if a trade closes, the bot waits for the price to touch the ORB Mid line before enabling the next trade.
Summary
The new code is safer (handles slippage), more accurate (calculates wicks historically), and more flexible (Stop vs Limit orders + Reversals).Thanks for the response to the new updated version.
The only other question I have is, is it possible to allow the bot to set/trigger a Stop Loss if the Target Profit is not triggered and the price returns, say, two ticks inside the High/Low level of the OR?
My strategy does not trade inside the OR; it only trades momentum when the High/Low of the OR has broken, and closes the trade (if triggered) when price reenters the OR.
Thanks
To rephrase my last question, can the bot be configured to offer the flexibility to trigger a Stop Loss or Target Profit determined by a certain number of pips?
On specific OR Breakout strategies (based on the OR timestamp/duration), the Stop Loss level, and Target Profit level are statistically optimized at different values.
For example, on OR Break strategy 1 - The SL is optimal at 2 ticks inside the OR Box (between H/L of OR). Target Profit 1 is optimal at 15 ticks above/below the OR H/L
On OR Breakout strategy 2 - The SL is optimal at 6 ticks inside the OR Box (between H/L of OR). Target Profit 1 is optimal at 9 ticks above/below the OR H/L
Cheers
Just to clarify: You want the Stop Loss and Take Profit to be calculated based on the OR Lines (OR High/Low), not based on the price where the trade actually fills. Is that correct?
Yes, that's correct, but I would like the flexibility to adjust the Pip values for the Stop Loss and Take Profit levels, as each OR Breakout strategy has a different Opening and Ending session times/duration.
E.g. one strategy has an Opening session time of 09:30 am EST with a Session ending time of 09:31 EST, and another strategy has an Opening session time of 08:30 am EST and an ending session time of 09:29 am EST.
I hope that makes sense
To clarify, I mean the OR interval (1min, 5 min, etc.), and the start and end session durations are dependent on the ORB strategy applied. This is also why I am looking for the flexibility to have the Stop Loss and Target profit level parameters changed for each strategy
- ORB High/Low Detection (Crucial Fix)