NexusFi: Find Your Edge

Home Menu


How get the time of a past bar in powerlanguage?

Discussion in EasyLanguage Programming

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

Search this Thread

How get the time of a past bar in powerlanguage?

  #1 (permalink)
Sevilla + Spain
Experience: Beginner
Platform: Multicharts
Trading: SP
Posts: 21 since May 2016
Thanks Given: 3
Thanks Received: 3


I'm developing an indicator for Multucharts.NET with Powrlanguage. I have a 5 minutes chart, and I need to do the following in calcbar() method.

Lets say it is 9:00 AM. The time of current bar is 9:00 AM. I need to sum the close price of all 9:00AM bars of last 10 days.

I have the following code:

Sum = 0
for (count = 1; count < 2880; count++){

if (bars.time[count] == bars.time[0]){
Sum = Sum + bar.close[count]

Then I want to plot SUM. But it plots 0. Doesn't work. The logical condition under the if appears not to be true ever.

How could I make it work?

Note: 2280 because each day has (24 * 12) 5 minute bars, and I want 10 days back, which gives 2880 bars to analyze.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
MC PL editor upgrade
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
25 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
 ABCTG   is a Vendor
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


you start with count = 1, so your condition if (bars.time[count] == bars.time[0]) can never become true.
You might want to check (using the Output for example) what values Bars.Time[0] holds.



Follow me on Twitter Reply With Quote

Last Updated on November 7, 2016

© 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