Script for Changing Templates

 

Hi all,

I have a script that changes the template on ALL open charts.  It has an input parameter to determine which template [0,1,2,etc].  Is there some code I could add to this which applies different templates to different markets?

For example:

if(market=GBP/USD)
{
apply template 1
}

if(market=EUR/USD)
{
apply template 2
}

 
mp21: Is there some code I could add to this which
So write it. Help you with what? You haven't stated a problem. Show us your attempt (using SRC) and state the nature of your problem.
          No free help
          urgent help.
 
whroeder1:
So write it. Help you with what? You haven't stated a problem. Show us your attempt (using SRC) and state the nature of your problem.
          No free help
          urgent help.

I can't write it, that's why I'm asking here.  I think I've explained perfectly well what I want to achieve.

 

I use this code to change the template on ALL open charts

#property show_inputs



#include <WinUser32.mqh>



#import "user32.dll"

   int      PostMessageA(int hWnd,int Msg,int wParam,int lParam);

   int      GetWindow(int hWnd,int uCmd);

   int      GetParent(int hWnd);

#import



extern int templateIndex = 0;

                   

int start()

{      

   bool blnContinue = true;   

   int intParent = GetParent( WindowHandle( Symbol(), Period() ) );   

   int intChild = GetWindow( intParent, GW_HWNDFIRST );  

     

   if ( intChild > 0 )   

   {

      if ( intChild != intParent )   PostMessageA( intChild, WM_COMMAND, 34800 + templateIndex, 0 );

   }

   else      blnContinue = false;   

   

   while( blnContinue )

   {

      intChild = GetWindow( intChild, GW_HWNDNEXT );   

   

      if ( intChild > 0 )   

      { 

         if ( intChild != intParent )   PostMessageA( intChild, WM_COMMAND, 34800 + templateIndex, 0 );

      }

      else   blnContinue = false;   

   }

   

   // Now do the current window

   PostMessageA( intParent, WM_COMMAND, 34800 + templateIndex, 0 );

}



I want to apply different templates to different markets with a single script, i.e GBPUSD gets one template of my choice, EURUSD gets a different one, USDJPY gets another one etc

 
mp21:

I can't write it, that's why I'm asking here.  I think I've explained perfectly well what I want to achieve.


It sounds to me like you're not asking for programming help, but you'd rather have someone make it for you from scratch? You should post this job to the freelance section or google search the internet for a script that does what you want. 

 

I just want to know the bit of code that does the following:

if(market=XXX){
apply template X
}

Coincidentally, nicholishen, it's for use on the off chance that you added the modification I requested to your excellent crosshair indicator


 
  1. mp21: I can't write it, that's why I'm asking here.  I think I've explained perfectly well what I want to achieve.
    You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
              No free help
              urgent help.

  2. mp21: I just want to know the bit of code that does the following:

    if(market=XXX){
    apply template X
    }

    Perhaps you should read the manual.
              ChartApplyTemplate - Chart Operations - MQL4 Reference

  3. mp21:

    I use this code to change the template on ALL open charts

       PostMessageA( intParent, WM_COMMAND, 34800 + templateIndex, 0 );}

    When you post code please use the SRC button! Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  4. Stop using that ancient code. A lot has changed since February 3, 2014 (Build 600)
 
whroeder1:
  1. You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
              No free help
              urgent help.

  2. Perhaps you should read the manual.
              ChartApplyTemplate - Chart Operations - MQL4 Reference

  3. When you post code please use the SRC button! Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  4. Stop using that anchant code. A lot has changed since February 3, 2014 (Build 600)

Ok, YOU aren't willing to help, whoroeder, that much is clear.  Hopefully someone else will, I thought that's what forums like this were for after all.

 
mp21: I thought that's what forums like this were for after all.

There are no slaves here. What part of "No free help" was unclear? We are willing to help, not to do your coding for free.

 
mp21:

Ok, YOU aren't willing to help, whoroeder, that much is clear.  Hopefully someone else will, I thought that's what forums like this were for after all.


He tried to help you. The answer is in his response. You missed it.

 
mp21:

Ok, YOU aren't willing to help, whoroeder, that much is clear.  Hopefully someone else will, I thought that's what forums like this were for after all.

He helped you. You can't see it, that's a pity.