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


How get the time of a past bar in powerlanguage?
Started: by fjgaspar Views / Replies:128 / 2
Last Reply: 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

Reply
 
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?

Hi,

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.

Thanks


Last edited by fjgaspar; November 5th, 2016 at 10: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)
 Vendor: abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,234 since Apr 2013
Thanks: 199 given, 694 received


fjgaspar,

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.

Regards,

ABCTG

Reply With Quote

Reply



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)
 

NinjaTrader 8: Tips and Tricks (part 2)

Mar 2
 

An Afternoon With FIO member @michaelleemoore

Elite only
 

Jigsaw Trading: Keys to successfully trading the open

Mar 9

Macro view: Trump Market Risk w/Piers Curran @ Amplify Trading

Elite only

Reading the Psychology of the Market w/Brett Steenbarger & Trading Technologies

Elite only

Hybrid Machine Learning (R and TradeStation) w/Murray Ruggiero

Elite only

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only
     

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


All times are GMT -4. The time now is 03:05 PM.

no new posts
Page generated 2017-02-26 in 0.07 seconds with 19 queries on phoenix via your IP 54.204.130.94