NexusFi: Find Your Edge


Home Menu

 





C# Help (ToTime)


Discussion in NinjaTrader

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




 
Search this Thread

C# Help (ToTime)

  #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: 200

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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Futures True Range Report
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 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: 200


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: ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,609 since Aug 2009
Thanks Given: 11,328
Thanks Received: 2,743


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 Twitter 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: 200

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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts