NexusFi: Find Your Edge


Home Menu

 





Powerlanguage and Multi time frames


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 4 posts (6 thanks)
    2. looks_two ShahramTor with 4 posts (0 thanks)
    3. looks_3 Jeff65 with 1 posts (5 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 10,945 views
    2. thumb_up 11 thanks given
    3. group 5 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread

Powerlanguage and Multi time frames

  #1 (permalink)
 
Laurent's Avatar
 Laurent 
France
 
Experience: Advanced
Platform: MC, MetaTrader
Trading: Stocks, Turbos, FX
Posts: 36 since Nov 2010
Thanks Given: 13
Thanks Received: 8

Hello!

I wanted to know if it is possible to use multi time frames in a function / indicator on MultiCharts / TradeStation.

Let's take an example. I want to create an indicator which will buy when the daily, the weekly and the monthly RSI are oversold.

Is it possible to do that? How? Is there some documentation/tutorial about it?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
Quant vue
Trading Reviews and Vendors
 
  #3 (permalink)
Jeff65
Gurnee, IL
 
Posts: 46 since Apr 2010
Thanks Given: 17
Thanks Received: 97



Laurent View Post
Hello!

I wanted to know if it is possible to use multi time frames in a function / indicator on MultiCharts / TradeStation.

Let's take an example. I want to create an indicator which will buy when the daily, the weekly and the monthly RSI are oversold.

Is it possible to do that? How? Is there some documentation/tutorial about it?

You simply load a chart with with the same symbol three times. Place each symbol on it's own subchart and timeframe. Place the daily as the primary chart to trade from. Place the weekly on subchart 2 and the monthly on subchart 3. You can then access all timeframes within a function (RSIalert) as demonstrated below.

 
Code
Variables:
  ReturnValue(false),
  RSIDaily(0),
  RSIWeekly(0, data2),
  RSIMontly(0, data3);


RSIDaily = RSI( Close, 14 );
RSIWeekly = RSI( Close of Data2, 14 );
RSIMontly = RSI( Close of Data3, 14 );

If ( RSIDaily < 30 )And ( RSIWeekly < 30 ) And ( RSIMontly < 30 ) Then
   ReturnValue =  TRUE
Else ReturnValue =  FALSE;

RSIalert = ReturnValue;

Reply With Quote
  #4 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1


Jeff65 View Post
You simply load a chart with with the same symbol three times. Place each symbol on it's own subchart and timeframe. Place the daily as the primary chart to trade from. Place the weekly on subchart 2 and the monthly on subchart 3. You can then access all timeframes within a function (RSIalert) as demonstrated below.

 
Code
Variables:
  ReturnValue(false),
  RSIDaily(0),
  RSIWeekly(0, data2),
  RSIMontly(0, data3);


RSIDaily = RSI( Close, 14 );
RSIWeekly = RSI( Close of Data2, 14 );
RSIMontly = RSI( Close of Data3, 14 );

If ( RSIDaily < 30 )And ( RSIWeekly < 30 ) And ( RSIMontly < 30 ) Then
   ReturnValue =  TRUE
Else ReturnValue =  FALSE;

RSIalert = ReturnValue;

Hi and thanks for this example.

I have a similar problem and have tried similar solution as yours but get wrong result and can not get why?
Here is my problem:
I have written a function called "Rico.F" that is true if Close<Range*0,1 and are lowest low then 5 last period.
Then I want to buy when yesterday (daily chart), AND first hour at next day (1-hour chart), AND frist 15-min after that first hour (15- min chart) all have Rico=true.
I have 15-min as data1, 1-H as data 2 and daily as data3.
As I can see, just the 15-min Rico is correct and I cannot figur out how the code can get true result for those other in my result.
Is this some issue that you recognize?
Thanks for any clue in advance



Var:
Rico(False),
RicoD(False, data3), //ricoplus igar
RicoH(False, data2), //ricoplus 1 timme
RicoM(False), //ricoplus 15 min




//Rico
Rico = False;
RicoD=Rico.F(3)[1];
RicoH=Rico.F(2)[1];
RicoM=Rico.F(1)[1];
If RicoD and RicoH and RicoM then Rico=True;
End;

//Buy
if Ricop and marketposition = 0 then buy this bar at Close;


And Function Rico.F ***************************************************''


Inputs:
DataSerie(Numeric);

Var:
Rikoschett(0),
Lowest6Day(False),
BarRange(False);


//Lowest Low 6 dagar
If Low of data(DataSerie)<Lowest(Low of data(DataSerie),5)[1] then Lowest6Day = True;

//Rikoschett
Rikoschett=0;
If Close<((Range of data(DataSerie)*0.1) + Low of data(DataSerie)) then Rikoschett=1;

//Signal
Rico.F = False;
if Rikoschett=1 and Lowest6Day then Rico.F = True;

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

ShahramTor,

I would start with tying the functions to the datastreams when you call them. If you don't do that, they will be computed on data1 (although they use some values of your other datastreams).
You should be able to find examples for that here in the forum or in the help files (the last lines of this article show how to do it for example: FundValue (Function)).

The next step would be to add print statements to your code, so you can find out what values it uses and where it goes wrong.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #6 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1


ABCTG View Post
ShahramTor,

I would start with tying the functions to the datastreams when you call them. If you don't do that, they will be computed on data1 (although they use some values of your other datastreams).
You should be able to find examples for that here in the forum or in the help files (the last lines of this article show how to do it for example: FundValue (Function)[/url]).

The next step would be to add print statements to your code, so you can find out what values it uses and where it goes wrong.

Regards,

ABCTG

Thans for your replay,

As you mention, I have a parameter in my function "DataSerie" which is the number of data stream.
I pass the numbers 1 to 3 for data1 to data3.

Do you see any thing wrong in that code or do you mean that it is not the correct way to make the function using different data stream?

Best regards

Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Please refer to the link I posted above and you will see how to tie the function to the datastream (which is not what you do with your code - it's missing that). Not tying the function to a specific datastream will result
in the function being executed in alignment with data1. This means that accessing a function value of [1] would give you the value the function had on the previous data1 bar and not on the previous data2 or data3 bar as you might expect. If you are fine with that, then no changes would be needed. In that case I'd still suggest to add the print statements (or to plot the function values), so you can track down what is going on more easily.

Regards,

ABCTG


ShahramTor View Post
Thans for your replay,

As you mention, I have a parameter in my function "DataSerie" which is the number of data stream.
I pass the numbers 1 to 3 for data1 to data3.

Do you see any thing wrong in that code or do you mean that it is not the correct way to make the function using different data stream?

Best regards


Follow me on Twitter Reply With Quote
Thanked by:
  #8 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1


ABCTG View Post
Please refer to the link I posted above and you will see how to tie the function to the datastream (which is not what you do with your code - it's missing that). Not tying the function to a specific datastream will result
in the function being executed in alignment with data1. This means that accessing a function value of [1] would give you the value the function had on the previous data1 bar and not on the previous data2 or data3 bar as you might expect. If you are fine with that, then no changes would be needed. In that case I'd still suggest to add the print statements (or to plot the function values), so you can track down what is going on more easily.

Regards,

ABCTG


Yes you are right!

I get information about data1 instead of data2 and data3.
I will try to test the function "FundValue(FundFieldName,PeriodsAgo,oErrorCode)" as you mentioned.
I need to read the Low, High and the Close of datastrams but do not find any "FundFieldName" associated to them (yet).
Sorry that I am such a beginner regarding EL, but I get error while compiling my code with "FundValue"!

------ Compiled with error(s): ------
Unknown Function

Does this work in MultiChart?

Thank you so much for your support!

Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

ShahramTor,

the link was just supposed to be an example of how to tie a function to a datastream (more specifically the last example in the link shows you how to do it). I didn't mean that you should use the FundValue function, as it will not give you what you are looking for.

By the way you can show your appreciation for posts on futures.io by clicking the "Thanks" button next to a post.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1


Hi,

I am afraid that I can not figure out how to tie the function to different data-stream.
Would you pls give me some examples?

Best regards

Reply With Quote




Last Updated on December 2, 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