NexusFi: Find Your Edge


Home Menu

 





C# Help (ToTime)


Discussion in NinjaTrader

Updated
    1. trending_up 2,178 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 201

I apologize if this is a basic question...

I'm trying to make an indicator that displays the value of another indicator at a specific time. So, for example, every day at 9:30 in the morning, the second indicator will display a horizontal line of the value of the first indicator at 9:30. Then for the following day, it will display a new value for the 9:30 value of the first indicator.

I've tried ToTime and GetBar, no luck.


"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MegaETH Proves the Crowd Right: Prediction Markets Calle …
Prediction Markets & Event Contracts
Memorandum Watch: How the 60-Day MOU Framework Makes May …
Prediction Markets & Event Contracts
New Section 301 Probes Target 16 Trading Partners -- Tra …
Traders Hideout
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
CFTC Launches Innovation Task Force for AI Trading Syste …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,580 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824


patbateman View Post
I apologize if this is a basic question...

I'm trying to make an indicator that displays the value of another indicator at a specific time. So, for example, every day at 9:30 in the morning, the second indicator will display a horizontal line of the value of the first indicator at 9:30. Then for the following day, it will display a new value for the 9:30 value of the first indicator.

I've tried ToTime and GetBar, no luck.

Just call the indicator with barsago, type SMA into the NT help, there should be an example. As this number will change with each new bar, vou have to recalculate, to do so you can use barssincesession or similar methods.

Vvhg


Hic Rhodos, hic salta.
Reply With Quote
  #3 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 201


I guess I'm not that great at C#...

Unfortunately Ninja will not allow a variable in the bars ago parameter. (Example: Close[x])

There has to be a way to make something like OHLC, but for an indicator and not a data series; the time could be entered on the indicator...

I've tried totime if statements that try to put the value into a variable, but no cigar.


"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #4 (permalink)
 
DavidHP's Avatar
 DavidHP 
Isla Mujeres, MX
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Ninjatrader / Optimus Futures / AmpFutures
Trading: NQ / ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,802 since Aug 2009
Thanks Given: 11,742
Thanks Received: 3,018


patbateman View Post
I apologize if this is a basic question...

Maybe this will help.
You will need to define StartTime, EndTime, startBar, etc.

This is basic code that uses a time slot (between two times start and end).
When the bar is between those two times, the line code is executed.
The startBar is a method to allow it to fire once and be reset when it is outside of the time slot.

 
Code
if ((ToTime(Time[0]) >= StartTime) && (ToTime(Time[0]) < EndTime))
	{
	if (startBar == 0 )
	<Do Something Here Like This>
         // DrawVerticalLine("T"+CurrentBar, 0, Color.Red, lineStyle, lineWidth);
         startBar = 1;	
	}
else
	{
	startBar = 0;
	}


Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind. . .
But Learning to Dance in the Rain ! ! !
Follow me on X Reply With Quote
Thanked by:
  #5 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 201

Okay...my purpose is that I'm trying to get an indicator that shows one value of another indicator for 24 hours. I'll give this a shot.

I was hoping to somehow take the CurrentDayOHL or anaOHL and modify it for an indicator.


"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote




Last Updated on October 8, 2012


© 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