stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Easy template/chart copy scripts/indicators
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3860
Page 2 of 4
Author:  flyer415 [ Tue Oct 21, 2014 1:46 pm ]
Post subject:  Easy template/chart copy scripts

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".
Author:  thomasmore [ Wed Nov 05, 2014 7:57 pm ]
Post subject:  Easy template/chart copy scripts extended

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
Author:  arts [ Fri Nov 07, 2014 3:33 pm ]
Post subject:  Easy template/chart copy scripts

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
Author:  SteveHopwood [ Sat Nov 08, 2014 9:57 am ]
Post subject:  Easy template/chart copy scripts/indicators

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:
Author:  thomasmore [ Sat Nov 08, 2014 10:49 am ]
Post subject:  Easy template/chart copy scripts/indicators

Fantastic job ! A real timesaver, well done.
cheers,
Ludo
Author:  SteveHopwood [ Sat Nov 08, 2014 12:07 pm ]
Post subject:  Easy template/chart copy scripts/indicators

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:
Author:  boinvest [ Sun Dec 21, 2014 11:18 pm ]
Post subject:  Easy template/chart copy scripts/indicators

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.
Author:  SteveHopwood [ Sun Dec 21, 2014 11:35 pm ]
Post subject:  Easy template/chart copy scripts/indicators

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:
Author:  trendinator [ Mon Jan 19, 2015 1:40 pm ]
Post subject:  Easy template/chart copy scripts/indicators

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
Author:  Reaper [ Sun Feb 01, 2015 3:07 pm ]
Post subject:  Easy template/chart copy scripts/indicators

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.
All times are UTC Page 2 of 4