How get the time of a past bar in powerlanguage? - EasyLanguage Programming | futures io social trading
futures io futures trading

How get the time of a past bar in powerlanguage?
Updated: Views / Replies:160 / 2
Created: by fjgaspar Attachments:0

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

How get the time of a past bar in powerlanguage?

  #1 (permalink)
Trading Apprentice
Sevilla + Spain
Futures Experience: Beginner
Platform: Multicharts
Favorite Futures: SP
Posts: 20 since May 2016
Thanks: 3 given, 2 received

How get the time of a past bar in powerlanguage?


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.


Last edited by fjgaspar; November 5th, 2016 at 09:51 AM. Reason: Not finished
Reply With Quote
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

  #3 (permalink)
Elite Member
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,284 since Apr 2013
Thanks: 203 given, 724 received


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.



Reply With Quote


futures io > > > > > How get the time of a past bar in powerlanguage?

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

Introducing iSystems with Stage 5 Trading

Apr 27

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)


Prototyping Python Strategies (part 2) w/Ran Aroussi

Elite only

Ask Me Anything w/Raymond Deux @ NinjaTrader

May 3

An Afternoon with FIO member Softsoap

Elite only

Machine Learning & Data Mining Bias w/Kris Longmore @ Robot Wealth

Elite only

Brannigan Barrett (TBA)

Elite only

FIO member Gomi (TBA)

Elite only

FuturesTrader71 (TBA)

Elite only

EasyLanguage Programming w/Chris @ ABC Trading Group

Elite only

Portfolio Diversification w/Brendon Delate

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerlanguage and Multi time frames Laurent EasyLanguage Programming 10 December 2nd, 2016 02:54 AM
Future Reference to Past Bar Vientomarsol EasyLanguage Programming 23 August 2nd, 2016 09:19 AM
Finding real price of current and past ADXVMA bar SolubleFish NinjaTrader Programming 10 May 20th, 2016 03:31 PM
Bar by Bar Cumulative Time and Sales Indicator - Sierra Chart waves1000 Sierra Chart 1 December 23rd, 2015 05:29 PM
Market Analyzer Indicator - Vol/AverageDaily Vol vs time past/6.5hours stockgoblin NinjaTrader Programming 2 March 10th, 2013 09:18 AM

All times are GMT -4. The time now is 10:25 PM.

no new posts
Page generated 2017-04-27 in 0.07 seconds with 20 queries on phoenix via your IP