Quantcast
Channel: MQL5: MetaTrader 5 trading, automated systems and strategy testing forum
Viewing all 75046 articles
Browse latest View live

Market Condition Evaluation based on standard indicators in Metatrader 5

$
0
0
newdigital:

I came too late to this celebration (big price movement) sorry :) But as I understand - it was high impacted news events at 09:30 GMT

By the way - we really need some indicator on the chart to avoid trading during some impacted news events.


It was some explanation of the price movement for yesterday: We will get through this, will not be an 'Apocalypse'.

So, read this article in NASDAQ: EUR/USD back above 1.3000 on Obama comments 

It means that I came too late for good price movement yesterday - Obama was the first one (I was second after him but it was too late sorry). 

 


Money management based on Turtle System

$
0
0
henlatourrette:
Hi everyone.

Does anyone know how can I add a money management strategy based on the turtle system to my EA?

It is, if X event happen, then.. open long/short with lot size according to the following formula:

Lot size Unit= (0,01x Account Balance) /(Contract Size x ATR (20) x Dollar Pip Value)

Then open 3 orders of the same lot size and on the same direction every 1/2 ATR. No stop loss and no take profit.

Thanks!

1. No stop loss, isn't that a lot of risk ? From what I read here, turtle money management have a huge drawdown, and that why it uses no Stop loss at all - or perhaps, ... I read the wrong article ?

2. In mql5, account balance is AccountInfoBalance with ACCOUNT_BALANCE identifier, contract size is SymbolInfoDouble with SYMBOL_TRADE_CONTRACT_SIZE identifier, and dollar pip value is SymbolInfoDouble with SYMBOL_TRADE_TICK_VALUE.

3. It is possible to open 3 orders (read: to open 3 pending orders) in MT5 but once pendings is opened, it will be merged into one single position. So you won't have 3 open position, but only have one position.

4. I don't understand what you mean by 1/2 ATR. Perhaps you'd like to explain more.

Your account is banned. You can send messages only to modetators

$
0
0
tonny:
How did you post this if banned? When i was accidentaly banned i couldnt even create a new account but after several complaints with evidence that proved i was wrongfully and selectively banned, the ban was lifted

tonny 2013.03.01 06:24 
I asked several times how long the ban was to last and none of you moderators told me and its only when i started complaining and gave evidence that i found the ban lifted

tonny 2013.03.01 06:32 
Ive got all the evidence that my ban was suspiciously done so please dont re awaken my ban issue or ill expose the evidence at mql5 too and its you moderators that will be embarassed lets just leave it at that its the past ok

tonny 2013.03.01 12:08 
I dont need to contact admins because its already sorted out and lets leave it at that. Nkt :-( this admins always spying looking to provoke me so as to get excuse to ban me when im busy helping people on forum. Lets leave my ban topic at that as it was already sorted.

Tonny, I'll answer you later, but perhaps you'd like to read this http://www.mql5.com/en/forum/8941/page28#comment_432748

Signal Systems

$
0
0

And this is practical illustration of asctrend concept:

 

Skipping x candles after closing a deal (using pause ?)

$
0
0

Hi phi.nuts!!

You did it again :) Here is the working code in my case if someone needs it it. And yes I could have continued on my other topic!

   datetime PauseTime = PauseHours*3600; 

     if (Pause){    
    
      if(TimeCurrent() > LastOrderTime + PauseTime){ 
      EAStatus="Trading"; }
    
      else{
      if(TimeCurrent() < LastOrderTime + PauseTime){ 
      EAStatus="Taking a Pause"; 
      return;
         }
      } 
   }  
      
   EAStatus="Trading"; 

 

Discussion of article "How to Become a Signals Provider for MetaTrader 4 and MetaTrader 5"

$
0
0
prget7:

What are the commission for mql5.com ? Sorry, I could not get these details.

Thanks

From Rules of Using the Signals Service


"6. The Signals Provider shall receive the payment less 20% commission retained by the "Signals" service."

Slow visual test on MT5 of MQL4 AMA indicator converted to MQL5

$
0
0

My problem is here http://imagicon.info/howto/mql5%20slow%20test%20ama.htm

 All standard indicators run very fast in visual testing mode,

but my converted from mql4 to mql5 ama custom indicator is very slow during visual testing even if I use 1 minute input not ticks

What to do? 

//+------------------------------------------------------------------+
//|                                                          AMA.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"

#property indicator_chart_window
#property indicator_buffers 3

#property indicator_color1 Sienna
#property indicator_type1   DRAW_LINE
#property indicator_width1  2

#property indicator_color2 DeepSkyBlue
#property indicator_type2   DRAW_ARROW

#property indicator_color3 Gold
#property indicator_type3   DRAW_ARROW




//---- input parameters
input int periodAMA=20;
input int nfast=3;
input int nslow=30;
input double G=2.0;
input double dK=2.0;

//---- buffers
double kAMAbuffer[];
double kAMAupsig[];
double kAMAdownsig[];

//+------------------------------------------------------------------+

int cbars=0, prevbars=0, prevtime=0;
double slowSC, fastSC;


#property indicator_plots   3

//--- indicator buffers

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);

//--- indicator buffers mapping
   SetIndexBuffer(0,kAMAbuffer,INDICATOR_DATA);
   SetIndexBuffer(1,kAMAupsig,INDICATOR_DATA);
   SetIndexBuffer(2,kAMAdownsig,INDICATOR_DATA);
   
   PlotIndexSetInteger(1, PLOT_ARROW, 159);
   PlotIndexSetInteger(2, PLOT_ARROW, 159);
   
   
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
      int i, pos=0;
      double noise=0.000000001, AMA, AMA0, signal, ER;
      double dSC, ERSC, SSC, ddK;
  
      //if (prevbars==rates_total) return (0);
      
      //---- TODO: add your code here
      slowSC=(2.0 /(nslow+1));
      fastSC=(2.0 /(nfast+1));

      //cbars=IndicatorCounted(prev_calculated);
      if(prev_calculated>0) cbars = prev_calculated-1;
      if(prev_calculated==0) cbars = 0;
      cbars=0;
      //Print(cbars);
      
      if (rates_total<=(periodAMA+2)) return (0);
      //---- check for possible errors
      if (cbars<0) return (-1);
      //---- last counted bar will be recounted
      if (cbars>0) cbars--;
      pos=periodAMA+2;
      AMA0=close[pos-1];
      
      while (pos<rates_total)
      {
         if (pos==periodAMA-2) AMA0=close[pos-1];
         signal=MathAbs (close[pos]-close[pos-periodAMA]);
         
         
         noise=0.000000001;
         for (i=0; i< periodAMA; i++)
         {
            noise=noise+MathAbs (close[pos-i]-close[pos-i-1]);
         }
         ER =signal/noise;
         dSC=(fastSC-slowSC);
         ERSC=ER*dSC;
         SSC=ERSC+slowSC;
         AMA=AMA0+(MathPow (SSC, G)*(close[pos]-AMA0));
         kAMAbuffer[pos]=AMA;
   
         ddK=(AMA-AMA0);
         if ((MathAbs (ddK)) > (dK*_Point) &&(ddK > 0)) kAMAupsig[pos] =AMA; else kAMAupsig[pos]=0;
         if ((MathAbs (ddK)) > (dK*_Point) &&(ddK < 0)) kAMAdownsig[pos]=AMA; else kAMAdownsig[pos]=0;
   
   
         AMA0=AMA;
         pos++;
      }
      
      

     
     prevbars=rates_total;
     
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                          AMA.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, by konKop,wellx"
#property link      "http://www.metaquotes.net"
 
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Sienna
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Gold
 
//---- input parameters
extern int       periodAMA=9;
extern int       nfast=2;
extern int       nslow=30;
extern double    G=2.0;
extern double    dK=2.0; 
 
//---- buffers
double kAMAbuffer[];
double kAMAupsig[];
double kAMAdownsig[];
 
//+------------------------------------------------------------------+
 
int    cbars=0, prevbars=0, prevtime=0;
 
double slowSC,fastSC;
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,2);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,159);
   //SetIndexDrawBegin(0,nslow+nfast);
   SetIndexBuffer(0,kAMAbuffer);
   SetIndexBuffer(1,kAMAupsig);
   SetIndexBuffer(2,kAMAdownsig);
   
   
   IndicatorDigits(4);
   
   //slowSC=0.064516;
   //fastSC=0.2;
   //cbars=IndicatorCounted();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i,pos=0;
   double noise=0.000000001,AMA,AMA0,signal,ER;
   double dSC,ERSC,SSC,ddK;
   
   if (prevbars==Bars) return(0);
    
//---- TODO: add your code here
   slowSC=(2.0 /(nslow+1));
   fastSC=(2.0 /(nfast+1));
   cbars=IndicatorCounted();
   if (Bars<=(periodAMA+2)) return(0);
//---- check for possible errors
   if (cbars<0) return(-1);
//---- last counted bar will be recounted
   if (cbars>0) cbars--;
   pos=Bars-periodAMA-2;
   AMA0=Close[pos+1];
   while (pos>=0)
     {
      if(pos==Bars-periodAMA-2) AMA0=Close[pos+1];
      signal=MathAbs(Close[pos]-Close[pos+periodAMA]);
      noise=0.000000001;
      for(i=0;i<periodAMA;i++)
       {
        noise=noise+MathAbs(Close[pos+i]-Close[pos+i+1]);
       }
      ER =signal/noise;
      dSC=(fastSC-slowSC);
      ERSC=ER*dSC;
      SSC=ERSC+slowSC;
      AMA=AMA0+(MathPow(SSC,G)*(Close[pos]-AMA0));
      kAMAbuffer[pos]=AMA;
 
      ddK=(AMA-AMA0);
      if ((MathAbs(ddK)) > (dK*Point) && (ddK > 0)) kAMAupsig[pos] =AMA; else kAMAupsig[pos]=0;
      if ((MathAbs(ddK)) > (dK*Point) && (ddK < 0)) kAMAdownsig[pos]=AMA; else kAMAdownsig[pos]=0; 
 
     
      AMA0=AMA;
      pos--;
     }
//----
   prevbars=Bars;
   return(0);
  }

Traders Joking

$
0
0

Good morning

Charles James Lewis (1830-1892) - Reading by the window 

 


Locked Operation for Signal Subscription

$
0
0
tiendung.1703:
Can someone explain for me? follow the attachment image, you can see that i have 6 subscriber with total 150 credit in, and i subscribe 1 signal, cost 6 credit, so it mean i will have 150 - 6 = 142 credit. but you can see, i only have about 70 credit, why? status of two operation from top is "Locked operation" and they're difference than order. can someone explain for me? Many thanks!
Is it something like this What does locked operation mean under payments tab? ?

About graphical objects

trix modified mq5 code

$
0
0
blnt06:

trix me to train up a separate color.
I need a different color downward trend.
Code share the knowledge here, I'd appreciate it.

There are plenty of unused variable and function in that code base, which actually  ... totally useless, but I won't comment on that in here.

Open MT5 and open it's MetaEditor by pressing F4. On MetaEditor, click "File" and click "Open Data Folder" and find MQL/indicator folder. Copy trix from code base and paste trix in indicator folder. Then open trix in MetaEditor by double clicking it.

Do this in MetaEditor :

1. Find this 4

#property indicator_type1   DRAW_LINE       
#property indicator_color1  Red

#property indicator_type2   DRAW_LINE
#property indicator_color2  Blue

And change it into

#property indicator_type1   DRAW_COLOR_LINE       
#property indicator_color1  clrWhite, clrBlue, clrRed

#property indicator_type2   DRAW_COLOR_LINE
#property indicator_color2  clrYellow, clrLime, clrLightBlue

2. Find this

//--- indicator buffers
double TriX1[],     // Dynamic array to hold the values of Trix
EXT_TriX1[],
TriX2[],            // Dynamic array to hold the values of Trix
EXT_TriX2[],
TriX3[],            // Dynamic array to hold the values of Trix Calculations
EXT_TriX3[],
TriX4[],            // Dynamic array to hold the values of Trix Calculations
EXT_TriX4[];

and change it into this

//--- indicator buffers
double TriX1[],     // Dynamic array to hold the values of Trix
TriX2[],            // Dynamic array to hold the values of Trix
TriX3[],            // Dynamic array to hold the values of Trix Calculations
TriX4[];            // Dynamic array to hold the values of Trix Calculations

We don't need all of those EXT_TriX :(

3. Find this, and change the value 1 into 2 and value 2 into 1, can you do that ?

   SetIndexBuffer(2,TriX2,INDICATOR_DATA);
   SetIndexBuffer(1,TriX3,INDICATOR_COLOR_INDEX);

 4. Find these, and delete them all, they are useless

   ArraySetAsSeries(TriX1,true);  // index Trix1 array as a time series
   ArraySetAsSeries(TriX2,true);  // index Trix1 array as a time series
   ArraySetAsSeries(TriX3,true);  // index Trix1 array as a time series
   ArraySetAsSeries(TriX4,true);  // index Trix1 array as a time series

   ArrayInitialize(TriX3,EMPTY_VALUE);    // Create Calculation Array As Value Zero
   ArrayInitialize(TriX4,EMPTY_VALUE);    // Create Calculation Array As Value Zero

5.  Find this, and add code below, between them

   (CopyBuffer(TriXHandle1,0,0,to_copy,TriX3));
   (CopyBuffer(TriXHandle2,0,0,to_copy,TriX4));
   //<<-- add code in here
//------------------------------------------------------------+
// Trix Gauge 1                                               +
//------------------------------------------------------------+

This is the code to add

   int limit;
   if (prev_calculated == 0)
       limit = prev_calculated + MathMax(Plot1, Plot2) + 1;
      else
       limit = prev_calculated - 1;

   for ( i = limit; i < rates_total; i++)
      {
      //--- now set line color for every bar
         if (TriX1 [i-1] == TriX1 [i])
            TriX3[i] = 0;
            else
            if (TriX1 [i-1] < TriX1 [i])
               TriX3[i] = 1;
               else
               TriX3[i] = 2;
               
      //--- now set line color for every bar
         if (TriX2 [i-1] == TriX2 [i])
            TriX4[i] = 0;
            else
            if (TriX2 [i-1] < TriX2 [i])
               TriX4[i] = 1;
               else
               TriX4[i] = 2;      
      }

 

6. Press F7 to compile and you may have some warning but you should not have an error if you doing it right, then try it in your MT5

 

 

Discussion of article "How to Subscribe to Trading Signals"

$
0
0
spike:
Do I have to use the same broker as Provider to receive automatic signals to my platform? 
It's recommended to use same broker as signal provider use, but it's not a mandatory. You can still subscribe using different broker.

Say & Ask anything/everything

$
0
0
JabulaniMbatha:

Why27639 ; connect failed and invalid account ?

You demo probably expired and so you need to open new demo account, but anyway, where did you saw that message, can you screenshot it and attach it here.

How can I know the credits equal Usd $?

I want to met people from Nigeria

$
0
0
taoreed1000:

you are sure u will find them everywhere i am a nigeria great african ADEBAYO KING

Where do you live in Nigeria?

I live in Osogbo Osun State


Market Condition Evaluation based on standard indicators in Metatrader 5

$
0
0

Market is going slowly for now - because it will not be any high impacted news events today so I do not expect big price movement.

Signal : Ask & Say Anything & Everything About MQL5 Trading Signal

$
0
0
Can I receive signals on AlpariUS or AlpariUK instead of AlpariFS? 

controls : How do I disable the chart scroll?

$
0
0

Finger, sorry, can you show your scroll code, so I don't have to build it from scratch, I kinda lazy today. 

 2 files PanelDialog.mqh and PanelIndicator.mq5   

//+------------------------------------------------------------------+
//|                                                  PanelDialog.mqh |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#include <Controls\Dialog.mqh>
#include <Controls\Panel.mqh>
#include <Controls\Edit.mqh>
#include <Controls\Label.mqh>
#include <Controls\SpinEdit.mqh>
#include <Controls\Scrolls.mqh>

//+------------------------------------------------------------------+
//| defines                                                          |
//+------------------------------------------------------------------+
//--- indents and spacing
#define INDENT_LEFT                         (11)      // left indent (including the border width)
#define INDENT_TOP                          (11)      // top indent (including the border width)
#define INDENT_RIGHT                        (11)      // right indent (including the border width)
#define INDENT_BOTTOM                       (11)      // bottom indent (including the border width)
#define CONTROLS_GAP_X                      (10)      // spacing along the X-axis
#define CONTROLS_GAP_Y                      (10)      // spacing along the Y-axis
//--- for labels
#define LABEL_WIDTH                         (50)      // size along the X-axis
//--- for edits
#define EDIT_WIDTH                          (50)      // size along the X-axis
#define EDIT_HEIGHT                         (20)      // size along the Y-axis
//--- for base colors (RGB)
#define BASE_COLOR_MIN                      (0)       // minimum value of the color component
#define BASE_COLOR_MAX                      (255)     // maximum value of the color component
//+------------------------------------------------------------------+
//| CPanelDialog class                                               |
//| Function: main application dialog                                |
//+------------------------------------------------------------------+
class CPanelDialog : public CAppDialog
  {
private:
   //--- additional controls
   CScrollH          m_scrollh;                       // object for display scroll
   CPanel            m_color;                         // object for displaying color
   CLabel            m_label_red;                     // "red" level caption object
   CEdit             m_field_red;                     // "red" value display object
   CLabel            m_label_green;                   // "green" level caption object
   CEdit             m_field_green;                   // "green" value display object
   CLabel            m_label_blue;                    // "blue" level caption object
   CSpinEdit         m_edit_blue;                     // "blue" value control object
   //--- parameter values
   int               m_red;                           // "red" value
   int               m_green;                         // "green" value
   int               m_blue;                          // "blue" value

public:
                     CPanelDialog(void);
                    ~CPanelDialog(void);
   //--- creation
   virtual bool      Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2);
   //--- chart event handler
   virtual bool      OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
   //--- properties
   void              SetRed(const int value);
   void              SetGreen(const int value);
   void              SetBlue(const int value);

protected:
   //--- creating additional controls
   bool              CreateScrollH(void);
   bool              CreateColor(void);
   bool              CreateRed(void);
   bool              CreateGreen(void);
   bool              CreateBlue(void);
   //--- internal event handlers
   virtual bool      OnResize(void);
   //--- event handlers for additional controls
   void              OnChangeBlue(void);
   //--- methods
   void              SetColor(void);
  };
//+------------------------------------------------------------------+
//| Event handling                                                   |
//+------------------------------------------------------------------+
EVENT_MAP_BEGIN(CPanelDialog)
   ON_EVENT(ON_CHANGE,m_edit_blue,OnChangeBlue)
EVENT_MAP_END(CAppDialog)
//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
CPanelDialog::CPanelDialog(void) : m_red((BASE_COLOR_MAX-BASE_COLOR_MIN)/2),
                                   m_green((BASE_COLOR_MAX-BASE_COLOR_MIN)/2),
                                   m_blue((BASE_COLOR_MAX-BASE_COLOR_MIN)/2)
  {
  }
//+------------------------------------------------------------------+
//| Destructor                                                       |
//+------------------------------------------------------------------+
CPanelDialog::~CPanelDialog(void)
  {
  }
//+------------------------------------------------------------------+
//| Creation                                                         |
//+------------------------------------------------------------------+
bool CPanelDialog::Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2)
  {
//--- calling the parent class method
   if(!CAppDialog::Create(chart,name,subwin,x1,y1,x2,y2))                           return(false);
//--- creating additional controls
   //if(!CreateColor())                                                               return(false);
   //if(!CreateRed())                                                                 return(false);
   //if(!CreateGreen())                                                               return(false);
   if(!CreateScrollH())                                                                return(false);
//--- setting the panel color
   SetColor();
//--- success
   return(true);
  }
//+------------------------------------------------------------------+
//| Color panel creation                                             |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateColor(void)
  {
//--- coordinates
   int x1=INDENT_LEFT+LABEL_WIDTH+CONTROLS_GAP_X+EDIT_WIDTH+CONTROLS_GAP_X;
   int y1=INDENT_TOP;
   int x2=ClientAreaWidth()-INDENT_RIGHT;
   int y2=ClientAreaHeight()-INDENT_BOTTOM;
//--- creating
   if(!m_color.Create(m_chart_id,m_name+"Color",m_subwin,x1,y1,x2,y2))              return(false);
   if(!m_color.ColorBorder(CONTROLS_EDIT_COLOR_BORDER))                             return(false);
   if(!Add(m_color))                                                                return(false);
//--- success
   return(true);
  }
//+------------------------------------------------------------------+
//| Creating the display element "Red" with explanatory caption      |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateRed(void)
  {
//--- coordinates
   int x1=INDENT_LEFT;
   int y1=INDENT_TOP;
   int x2=x1+EDIT_WIDTH;
   int y2=y1+EDIT_HEIGHT;
//--- creating the caption
   if(!m_label_red.Create(m_chart_id,m_name+"LabelRed",m_subwin,x1,y1+1,x2,y2))     return(false);
   if(!m_label_red.Text("Red"))                                                     return(false);
   if(!Add(m_label_red))                                                            return(false);
//--- adjusting the coordinates
   x1+=LABEL_WIDTH+CONTROLS_GAP_X;
   x2=x1+EDIT_WIDTH;
//--- creating the display element
   if(!m_field_red.Create(m_chart_id,m_name+"Red",m_subwin,x1,y1,x2,y2))            return(false);
   if(!m_field_red.Text(IntegerToString(m_red)))                                    return(false);
   if(!m_field_red.ReadOnly(true))                                                  return(false);
   if(!Add(m_field_red))                                                            return(false);
//--- success
   return(true);
  }
//+------------------------------------------------------------------+
//| Creating the display element "Green" with explanatory caption    |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateGreen(void)
  {
//--- coordinates
   int x1=INDENT_LEFT;
   int y1=INDENT_TOP+(EDIT_HEIGHT+CONTROLS_GAP_Y);
   int x2=x1+EDIT_WIDTH;
   int y2=y1+EDIT_HEIGHT;
//--- creating the caption
   if(!m_label_green.Create(m_chart_id,m_name+"LabelGreen",m_subwin,x1,y1+1,x2,y2)) return(false);
   if(!m_label_green.Text("Green"))                                                 return(false);
   if(!Add(m_label_green))                                                          return(false);
//--- adjusting the coordinates
   x1+=LABEL_WIDTH+CONTROLS_GAP_X;
   x2=x1+EDIT_WIDTH;
//--- creating the display element
   if(!m_field_green.Create(m_chart_id,m_name+"Green",m_subwin,x1,y1,x2,y2))        return(false);
   if(!m_field_green.Text(IntegerToString(m_green)))                                return(false);
   if(!m_field_green.ReadOnly(true))                                                return(false);
   if(!Add(m_field_green))                                                          return(false);
//--- success
   return(true);
  }
//+------------------------------------------------------------------+
//| Creating the control "Blue" with explanatory caption             |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateBlue(void)
  {
//--- coordinates
   int x1=INDENT_LEFT;
   int y1=INDENT_TOP+2*(EDIT_HEIGHT+CONTROLS_GAP_Y);
   int x2=x1+EDIT_WIDTH;
   int y2=y1+EDIT_HEIGHT;
//--- creating the caption
   if(!m_label_blue.Create(m_chart_id,m_name+"LabelBlue",m_subwin,x1,y1+1,x2,y2))   return(false);
   if(!m_label_blue.Text("Blue"))                                                   return(false);
   if(!Add(m_label_blue))                                                           return(false);
//--- adjusting the coordinates
   x1+=LABEL_WIDTH+CONTROLS_GAP_X;
   x2=x1+EDIT_WIDTH;
//--- creating the display element
   if(!m_edit_blue.Create(m_chart_id,m_name+"Blue",m_subwin,x1,y1,x2,y2))           return(false);
   if(!Add(m_edit_blue))                                                            return(false);
   m_edit_blue.MinValue(BASE_COLOR_MIN);
   m_edit_blue.MaxValue(BASE_COLOR_MAX);
   m_edit_blue.Value(m_blue);
//--- success
  return(true);
  }
  
//+------------------------------------------------------------------+
//| Creating the control "ScrollV"                                   |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateScrollH(void)
  {
//--- coordinates
   int x1=INDENT_LEFT;
   int y1=INDENT_TOP+2*(EDIT_HEIGHT+CONTROLS_GAP_Y);
   int x2=x1+EDIT_WIDTH;
   int y2=y1+EDIT_HEIGHT;
   
//--- creating the caption
   if(!m_scrollh.Create(m_chart_id,m_name+"ScrollV",m_subwin,x1,y1+1,x2,y2))      return(false);
   m_scrollh.Width(100);
   m_scrollh.MinPos(1);
   m_scrollh.MaxPos(20);
   if(!Add(m_scrollh))                                                           return(false);
   
//--- success
   return(true);
  }  
  
  
//+------------------------------------------------------------------+
//| Setting the "Red" value                                          |
//+------------------------------------------------------------------+
void CPanelDialog::SetRed(const int value)
  {
//--- checking
   if(value<0 || value>255) return;
//--- saving
   m_red=value;
//--- setting
   m_field_red.Text(IntegerToString(value));
//--- setting the panel color
   SetColor();
  }
//+------------------------------------------------------------------+
//| Setting the "Green" value                                        |
//+------------------------------------------------------------------+
void CPanelDialog::SetGreen(const int value)
  {
//--- checking
   if(value<0 || value>255) return;
//--- saving
   m_green=value;
//--- setting
   m_field_green.Text(IntegerToString(value));
//--- setting the panel color
   SetColor();
  }
//+------------------------------------------------------------------+
//| Setting the "Blue" value                                         |
//+------------------------------------------------------------------+
void CPanelDialog::SetBlue(const int value)
  {
//--- checking
   if(value<0 || value>255) return;
//--- saving
   m_blue=value;
//--- setting
   m_edit_blue.Value(value);
//--- setting the panel color
   SetColor();
  }
//+------------------------------------------------------------------+
//| Resize handler                                                   |
//+------------------------------------------------------------------+
bool CPanelDialog::OnResize(void)
  {
//--- calling the parent class method
   if(!CAppDialog::OnResize()) return(false);
//--- changing the color panel width
   m_color.Width(ClientAreaWidth()-(INDENT_RIGHT+LABEL_WIDTH+CONTROLS_GAP_X+EDIT_WIDTH+CONTROLS_GAP_X+INDENT_LEFT));
//--- success
   return(true);
  }
//+------------------------------------------------------------------+
//| Handler of the event of changing the "blue" level                |
//+------------------------------------------------------------------+
void CPanelDialog::OnChangeBlue(void)
  {
//--- saving
   m_blue=m_edit_blue.Value();
//--- setting the panel color
   SetColor();
  }
//+------------------------------------------------------------------+
//| Setting the panel color                                          |
//+------------------------------------------------------------------+
void CPanelDialog::SetColor(void)
  {
   m_color.ColorBackground(m_red+(m_green<<8)+(m_blue<<16));
  }
//+------------------------------------------------------------------+

 

 

 

//+------------------------------------------------------------------+
//|                                               PanelIndicator.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_plots               0
#property indicator_buffers             0
#property indicator_minimum             0.0
#property indicator_maximum             0.0
//+------------------------------------------------------------------+
//| Include files                                                    |
//+------------------------------------------------------------------+
#include "PanelDialog.mqh"
//+------------------------------------------------------------------+
//| Global variables                                                 |
//+------------------------------------------------------------------+
CPanelDialog ExtDialog;
//+------------------------------------------------------------------+
//| Initialization                                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- creating the application dialog
   if(!ExtDialog.Create(0,"Panel Indicator",0,0,0,0,130))
      return(-1);
//--- starting the application
   if(!ExtDialog.Run())
      return(-2);
//--- creating the timer
   EventSetTimer(1);
//--- success
   return(0);
  }
//+------------------------------------------------------------------+
//| Deinitialization                                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroying the dialog
   ExtDialog.Destroy();
//--- killing the timer
   EventKillTimer();
  }
//+------------------------------------------------------------------+
//| Iteration                                                        |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//--- changing the dialog property
   ExtDialog.SetRed(MathRand()%256);
//--- returning the prev_calculated value for the next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| Timer event handler                                              |
//+------------------------------------------------------------------+
void OnTimer()
  {
//--- changing the dialog property
   ExtDialog.SetGreen(MathRand()%256);
  }
//+------------------------------------------------------------------+
//| Chart event handler                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//--- handling the event
   ExtDialog.ChartEvent(id,lparam,dparam,sparam);
  }
//+------------------------------------------------------------------+

How to change lot size in ExpertMAMA ?

historical data for MT5

Viewing all 75046 articles
Browse latest View live