NexusFi: Find Your Edge


Home Menu

 





for MC.NET C#: How do I input a time, and compare it to the current bar's time?


Discussion in MultiCharts

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




 
Search this Thread
  #1 (permalink)
thoughtful
Klamath Falls OR
 
Posts: 60 since Apr 2020
Thanks Given: 21
Thanks Received: 80

How do I work with times? There's no help from MC documentation, I found some builtin indicators that use time but it didn't help me, and online C# documentation for DateTime is so confusing & complex I gave up trying to understand it.

I'm making a simple indicator that plots vertical lines to mark the day session start-time & end-time. MC (and most other software) doesn't have a builtin indicator to do this [lame].

*******************
my code so far:

[Input] public int StartTime {get;set;}
...
StartTime= 800; //8:00 AM, I only need to input hours & minutes
...
if(Bars.Time[0] >= StartTime){ //this won't compile obviously
//I draw a vertical line to mark the start of the day session, I know how to do this part
}
*******************

Can anyone tell me how to code this?
Thanks!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pakistan Mediator in Tehran as Hormuz Normalization Coll …
Prediction Markets & Event Contracts
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
SEC Advisory Committee Backs Tokenized Securities Exempt …
Traders Hideout
$24.5 Billion Record Month: Prediction Markets Shatter A …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
The Pivot Point 113.6³ — Navigating the Prediction of …
26 thanks
Sober Journey With S&P
17 thanks
The Confluence Meter: A Multi-Layered Signal Framework B …
11 thanks
NT8 color choices
10 thanks
Volume Indicators
7 thanks
  #2 (permalink)
thoughtful
Klamath Falls OR
 
Posts: 60 since Apr 2020
Thanks Given: 21
Thanks Received: 80

OP here...
I just figured out a solution. Doh. Believe me, I tried to figure it out before, but I just happened to find more info on the DateTime type by chance. Boy, C# stuff can be cryptic/confusing.

*******************
here's my solution:

[Input] public int StartTime {get;set;} //same as before
...
StartTime= 800; //same as before
...
if((Bars.Time[0].Hour * 100)+Bars.Time[0].Minute >= StartTime){ //the solution
//draw a vertical line
}
*******************

So, NEVERMIND!


Reply With Quote
  #3 (permalink)
thoughtful
Klamath Falls OR
 
Posts: 60 since Apr 2020
Thanks Given: 21
Thanks Received: 80


Too bad you can't delete your threads, now this thread will be on this website for YEARS LOLOL.


Reply With Quote




Last Updated on June 15, 2020


© 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