Jump to content
Medved Trader Forums

Cumulative $TICK chart


Recommended Posts

i created a cumulative $TICK paintbar if anyone is interested.  It uses the Compare Symbol indicator, so the underlying chart doesn't have to be the $TICK itself.  I have two calls for SessionInfo, which could maybe reduced to one somehow.  Thanks to Jerry and Mike for creating the loop functions.


 

TickCumulative.png

TICK.png


 

public void MainCalculation()

{
    var TT                                             = GetTradingSessionInfo(Timestamp);
    TradingSessionInfo session = GetTradingSessionInfo(Timestamp);
    TimeSpan TS                              = (Timestamp[0] - session.SessionStart);     // number of minutes into session
    int p                                                = (int) TS.TotalMinutes;     // convert Timespan to integer
    
    if (DateTime.UtcNow<TT.DayStart.AddDays(1))     // only plot current day
    {
        SetColor(Color.Black);
        SetYValue(Sum(p,TICK));   //plots a running total using the Sum loop function
    }
}
 

Edited by nasdorq
missing line
Link to comment
Share on other sites

with single sessioninfo call:
public void MainCalculation()
{
    TradingSessionInfo session = GetTradingSessionInfo(Timestamp);
    TimeSpan TS                              = (Timestamp[0] - session.SessionStart);     // number of minutes into session
    int p                                                = (int) TS.TotalMinutes;     // convert Timespan to integer
    
    if (DateTime.UtcNow<session.DayStart.AddDays(1))     // only plot current day
    {
        SetColor(Color.Black);
        SetYValue(Sum(p,TICK));   //plots a running total using the Sum loop function
    }
}

NOTE: this code assumes that the paintbar is running on 1 minute bars.  Could be optimized, though that would complicate the code a bit.

  • Thanks 1
Link to comment
Share on other sites

  • 7 months later...
On 6/19/2019 at 3:33 PM, Jerry Medved said:

with single sessioninfo call:
public void MainCalculation()
{
    TradingSessionInfo session = GetTradingSessionInfo(Timestamp);
    TimeSpan TS                              = (Timestamp[0] - session.SessionStart);     // number of minutes into session
    int p                                                = (int) TS.TotalMinutes;     // convert Timespan to integer
    
    if (DateTime.UtcNow<session.DayStart.AddDays(1))     // only plot current day
    {
        SetColor(Color.Black);
        SetYValue(Sum(p,TICK));   //plots a running total using the Sum loop function
    }
}

NOTE: this code assumes that the paintbar is running on 1 minute bars.  Could be optimized, though that would complicate the code a bit.

How would you do this to show on historical charts, a daily chart to be exact? That is, show paintbar for only the current month.

Thanks in advance

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...