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

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming


How get the time of a past bar in powerlanguage?
Started:November 5th, 2016 (10:46 AM) by fjgaspar Views / Replies:63 / 2
Last Reply:November 7th, 2016 (04:08 AM) 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?

Old November 5th, 2016, 10:46 AM   #1 (permalink)
Trading Apprentice
Sevilla + Spain
 
Futures Experience: Beginner
Platform: Multicharts
Favorite Futures: SP
 
Posts: 14 since May 2016
Thanks: 2 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
     

Old November 5th, 2016, 10:46 AM   #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.

     

Old November 7th, 2016, 04:08 AM   #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,151 since Apr 2013
Thanks: 191 given, 648 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 > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming > 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)
 

Trading Technologies: ADL hands-on

Dec 13

Normal webinar schedule resumes after the holidays

January

Ernie Chan: Risk Management

Elite only

Dedicated Trading Servers: Advantages/Disadvantages w/sam028

Elite only

An Afternoon with FIO member Massive I

Elite only

Leo Murphy: TBA

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 06:44 AM.

Copyright © 2016 by futures.io. 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.
 
no new posts
Page generated 2016-12-10 in 0.07 seconds with 19 queries on phoenix via your IP 54.166.37.177