Using Weekly and Monthly Time Frames in Script

This is the place to discuss EdgeRater Chart Script

Moderator: Chris White

Post Reply
Chris White
Posts: 201
Joined: Mon Nov 29, 2010 9:21 pm

Using Weekly and Monthly Time Frames in Script

Post by Chris White »

A script will be run automatically in weekly mode if it is placed onto a weekly chart and monthly if placed on a monthly chart, but what if you want to have the script always run in Weekly or Monthly mode regardless of the chart it is placed on?

The way to do that is to have the 'Period Independent' version of the script as one script and call it with a period specified from another.

Imagine the following script is called Test1 and is in your 'My Scripts' library

Code: Select all

Event: STREAK(C)==N;
Params:
Name Type Default Min Max
N Double 4 1 10000

Now you could create a script called Test1Weekly which would look like this:

Code: Select all

Event: FML('My.Test1(N)#WEEK1');
Params:
Name Type Default Min Max
N Double 4 1 10000

Note that to call a script in your 'My Scripts' Library you have to prefix the script name with 'My.'

You could write a similar script for the Monthly version.

These scripts can be added to a chart and also to the Entries and Exits area of the program for generating trading signals.

If you are just creating a Trading Template to show the current state of the indicator, you don't actually need to create separate versions of the script. The template allows you to specify #WEEK1, #MONTH1 at the end of the script name. Take a look at the weekly squeeze template for an example - there cell H2 contains the value 'GL_SqueezeLength(1)#WEEK1' which calls the GL_SqueezeLength script in Weekly mode (1 week cycle).
nibor200
Posts: 63
Joined: Wed Oct 22, 2014 11:03 am

Re: Using Weekly and Monthly Time Frames in Script

Post by nibor200 »

Chris,

I can't find the term "STREAK" anywhere in the online code documentation but it appears it might be the number of consecutive days that a condition such as "Close" is greater than the prior "Close", given that the "Close" the day before was lower than its prior day's "Close" and the day after the streak ends is also lower than its' prior day "Close".

Is this the correct definition for the STREAK command?
Is it defined somewhere else than the online documentation?

Thanks,
Ed S.
Post Reply