NexusFi: Find Your Edge


Home Menu

 





Strategy: second data series for using correct entry times with renko-bars


Discussion in NinjaTrader

Updated
    1. trending_up 1,384 views
    2. thumb_up 1 thanks given
    3. group 8 followers
    1. forum 2 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 
Renkotrader's Avatar
 Renkotrader 
Frankfurt, Hessen, Germany
 
Experience: Advanced
Platform: NinjaTrader 8
Broker: APEX & NinjaTrader Brokerage
Trading: 6E, 6J, CL, ES, FDAX, FGBL, GC, HG, NQ, RTY, SI, YM
Posts: 541 since May 2012
Thanks Given: 1,422
Thanks Received: 227

Hello strategy programmers,

I am using a entry period in my strategy.

While working with time bars I am having no problems with the correct entry time span.

If I am changing to renko-bars, then the system is not checking, that an order is to late.
I am using close bars and that will not change.

Here is the text, that I wrote with starting at code line 77:

// Here is the check for the valid entry period.
// Most likely the assignment to the second data series from the 1-minute chart is missing here,
// because by means of Renko probably only the times of the closed bars are used instead of realtime.
// (by the way, the staregy works with closed renkos, i.e. close-bars).
// The question arises whether the time condition has to be included elsewhere.
// However, previous attempts proved unsuccessful.


You will find the ExampleStrategy as attachment.

Thank you for helping me!

Best regards,
Renkotrader


Attached Files
Elite Membership required to download: ExampleEntryTimeZones.cs
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Hungary Called for Magyar at 97pct, Ending 16-Year Orban …
Prediction Markets & Event Contracts
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
SEC and CFTC Unlock Customer Cross-Margining for Treasur …
Treasury Notes and Bonds
NinjaTrader Parent Payward Acquires Bitnomial for $550M …
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #2 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 249 since Jun 2011
Thanks Given: 29
Thanks Received: 367

Just use the secondary time series as the input for the if statement. Thats is secondary Times[1][0] instead of primary Times[0][0]

 
Code
(Times[1][0].TimeOfDay >= startTime.TimeOfDay) && (Times[1][0].TimeOfDay <= endTime.TimeOfDay))


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 249 since Jun 2011
Thanks Given: 29
Thanks Received: 367



Renkotrader View Post
Hello strategy programmers

Actually having a second look at this that if statement does nothing. You should to turn it into a bool variable like this,

 
Code
bool CanTrade = Times[1][0].TimeOfDay >= startTime.TimeOfDay && Times[1][0].TimeOfDay <= endTime.TimeOfDay
Then use that bool in the crossover condition. Something like this.

 
Code
if (CanTrade)
    {
if (CrossAbove(smaFast, smaSlow, 1))
EnterLong();
        else if (CrossBelow(smaFast, smaSlow, 1))
EnterShort();
    }
Of course then you will have to handle the exits after you have a position and CanTrade is =false


Follow me on X Reply With Quote




Last Updated on October 14, 2023


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts