Easy template/chart copy scripts/indicators

flyer415
Trader
Posts: 10
Joined: Thu Dec 15, 2011 12:33 am

Easy template/chart copy scripts

Post by flyer415 »

The Alphabetical Script doesn't technically sort them into Alphabetical arrangement.

The array sorting function used actually sorts them in the manner in which they are listed in the Pairs Array.

Perhaps a minor point but a very useful point.

I like looking at the JPY then USD then crosses in order.

So if I arrange the pairs Array in that order then that is how they are sorted.

The point being is that the script is much more powerful then just Alphabetical Sort.

Another easy change to the script is to ask for a Filename that is a current template. Minor code changes such as adding an extern variable, making Filename equal to that variable, commenting out the ChartSaveTemplate function..see below.

Code: Select all

#property show_inputs
extern string templ ="input template";

int INDEX[28];
string PAIRS[28]= {"EURUSD","AUDCHF","AUDJPY","AUDNZD","AUDUSD","CADCHF","CADJPY","CHFJPY","EURAUD","EURCAD","EURCHF","EURGBP","EURJPY","EURNZD",
                    "AUDCAD","GBPAUD","GBPCAD","GBPCHF","GBPJPY","GBPNZD","GBPUSD","NZDCAD","NZDCHF","NZDJPY","NZDUSD","USDCAD","USDCHF","USDJPY"};
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
   ArrayInitialize(INDEX,-1);  
 
   string FileName = templ;//"temp_template"; //file name to save current template
   long CurrentChart = ChartID();//get current chart ID
  // ChartSaveTemplate(0, FileName);//save current template
   int period=Period();
   int n=0;
Now you can sort them in any arrangement that you wish and you could apply any template that you wish.

A truly useful script by "arts".
thomasmore
Trader
Posts: 269
Joined: Tue Nov 15, 2011 10:35 pm
Location: Knokke, Belgium

Easy template/chart copy scripts extended

Post by thomasmore »

Could someone make a script where you can "user select" a TF, a template and that opens a chart for all pairs visible in the Market Watch Window, and include the "Sort alphabetical Order" script? Very useful if you have to open another Empty4 instance to house a new EA.
Ludo
arts
Trader
Posts: 10
Joined: Thu Nov 17, 2011 2:09 pm

Easy template/chart copy scripts

Post by arts »

Hi Ludo what you are looking for is a logical progression from my previous script.

I'm not so sure about creating charts for all instruments in the Market Watch window so I've done it a little bit differently.

Also, as I wanted to use some functionality which is not available in scripts, this has to be an indicator. (There's no issue with this as the last thing it does is delete the original chart its on.)

You should have just one chart open on your terminal set up as you want it and for the timeframe you want. Attach the indicator and you will see a display with 28 pairs which you can easily select/deselect (default all selected) . Once you've done this press 'ok' and it will create charts for the pairs selected in the TF and template of the original chart.

If you would like to see other instruments they can be easily added to the Pairs Array and as someone else has already mentioned, you can change the order of instruments in the Array from alphabetical to any order you want.

John
You do not have the required permissions to view the files attached to this post.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Easy template/chart copy scripts/indicators

Post by SteveHopwood »

Fantastic again John - a million thanks. :clap: :clap: :clap:

I have copied the indi into post 1, along with your description so it is easy to find. I have taken the liberty of adding 'Indicator' into the file name to emphasise that it goes in our Indi folder.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
thomasmore
Trader
Posts: 269
Joined: Tue Nov 15, 2011 10:35 pm
Location: Knokke, Belgium

Easy template/chart copy scripts/indicators

Post by thomasmore »

Fantastic job ! A real timesaver, well done.
cheers,
Ludo
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Easy template/chart copy scripts/indicators

Post by SteveHopwood »

I didn't realise until I played with it that changing Johns chart opener name needs a teensy change in the code.

Replace line 60

Code: Select all

{if(INDEX[p]>=0){cn=ChartOpen(PAIRS[p],period); ChartApplyTemplate(cn, FileName); ChartIndicatorDelete(cn,0,"Open Charts In Alphabetical Order"); Close_gui();} }  
with

Code: Select all

{if(INDEX[p]>=0){cn=ChartOpen(PAIRS[p],period); ChartApplyTemplate(cn, FileName); ChartIndicatorDelete(cn,0,"Open Charts In Alphabetical Order Indicator"); Close_gui();} }  
or redownload from post 1.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
boinvest
Trader
Posts: 142
Joined: Wed May 28, 2014 6:56 am
Location: Netherlands

Easy template/chart copy scripts/indicators

Post by boinvest »

After a lot of testing, trail error, looking at the code I found out why the indi and script did'nt work for me on some instances.
Empty4 was pushing updates to me..
Guess I've learned the hard way, :arrrg:
that these tools are working fine on build 745,
But when you are using build 765 you're stuffed.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Easy template/chart copy scripts/indicators

Post by SteveHopwood »

boinvest » Sun Dec 21, 2014 11:18 pm wrote:After a lot of testing, trail error, looking at the code I found out why the indi and script did'nt work for me on some instances.
Empty4 was pushing updates to me..
Guess I've learned the hard way, :arrrg:
that these tools are working fine on build 745,
But when you are using build 765 you're stuffed.
You have managed to make anything work on jerrybuild 7xx? Wow. Well done. :clap: That is a lot more than the rest of us have managed. We found ourselves stuffed on any jerrybuild starting with 7.

Just keep an eye on your charts, ok? Jerrybuild 7xx is the most appalling bollocks ever released and will fuck you up every time you take your eye off it. Good luck.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
trendinator
Trader
Posts: 156
Joined: Sat Dec 06, 2014 12:22 am

Easy template/chart copy scripts/indicators

Post by trendinator »

ive made a mod and it works in 765. has been tested by another member here and described as 'flawless'

the only quirk is that you have to save a template first and then select that template in the input (actually its a feature ;) ). defaults to 'default'

the problem was ChartIndicatorDelete.
Open Charts In Alphabetical Order Indicator_a.mq4
You do not have the required permissions to view the files attached to this post.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Easy template/chart copy scripts/indicators

Post by Reaper »

trendinator » Mon Jan 19, 2015 1:40 pm wrote:ive made a mod and it works in 765. has been tested by another member here and described as 'flawless'

the only quirk is that you have to save a template first and then select that template in the input (actually its a feature ;) ). defaults to 'default'

the problem was ChartIndicatorDelete.
I tested this and it seems like it works in the fact it loads all the pairs and with the template, but each EA has a sad face. If I'm doing something wrong, please let me know, otherwise I take it this mod still needs a little tweaking.

EDIT: The EA's Allow Live Trading gets turned off even though the template is saved with it on.
.
Post Reply

Return to “Chart/template copying and history loading”