//+------------------------------------------------------------------+
//| gestion_du_capital.mq4 |
//| Copyright 2015, hamza Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, hamza Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
input double Stop_Loss = 1.0950 ;
input int Gestion_Capital = 5 ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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[])
{
//---
double sprea = MarketInfo(Symbol(),MODE_SPREAD);
double V_P = MarketInfo(Symbol(),MODE_TICKVALUE);
double Valeur_spread = sprea * V_P ;
double N_P_B = ((Ask - Stop_Loss)* 10000)+Valeur_spread;
double N_P_S = (Stop_Loss - Bid)* 10000;
double SL_B = V_P * N_P_B ;
double Formule_1_B = SL_B / Gestion_Capital;
double Formule_2_B = (0.1 / Formule_1_B) ;
//Comment("spread : "+DoubleToStr(sprea/10,1));
Comment(Formule_2_B);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| gestion_du_capital.mq4 |
//| Copyright 2015, hamza Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, hamza Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
input double Stop_Loss = 1.0950 ;
input int Gestion_Capital = 5 ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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[])
{
//---
double sprea = MarketInfo(Symbol(),MODE_SPREAD);
double V_P = MarketInfo(Symbol(),MODE_TICKVALUE);
double Valeur_spread = sprea * V_P ;
double N_P_B = ((Ask - Stop_Loss)* 10000)+Valeur_spread;
double N_P_S = (Stop_Loss - Bid)* 10000;
double SL_B = V_P * N_P_B ;
double Formule_1_B = SL_B / Gestion_Capital;
double Formule_2_B = (0.1 / Formule_1_B) ;
//Comment("spread : "+DoubleToStr(sprea/10,1));
Comment(Formule_2_B);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//--- input parameters
input double STOP=1.2;
input double STOP_VAL=5.0;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
double Tick_Val=MarketInfo(Symbol(),MODE_TICKVALUE);
int B_L=int(MathAbs((Ask-STOP))/Point);
int S_L=int(MathAbs((STOP-Bid))/Point);
double B_Lot=NormalizeDouble(STOP_VAL/(Tick_Val*B_L),2);
double S_Lot=NormalizeDouble(STOP_VAL/(Tick_Val*S_L),2);
Alert("Max Buy Lot :"+ DoubleToStr(B_Lot,2)+" Max Sell Lot :"+DoubleToStr(S_Lot,2));
}
//+------------------------------------------------------------------+
//--- input parameters
input double STOP=1.2;
input double STOP_VAL=5.0;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
double Tick_Val=MarketInfo(Symbol(),MODE_TICKVALUE);
int B_L=int(MathAbs((Ask-STOP))/Point);
int S_L=int(MathAbs((STOP-Bid))/Point);
double B_Lot=NormalizeDouble(STOP_VAL/(Tick_Val*B_L),2);
double S_Lot=NormalizeDouble(STOP_VAL/(Tick_Val*S_L),2);
Alert("Max Buy Lot :"+ DoubleToStr(B_Lot,2)+" Max Sell Lot :"+DoubleToStr(S_Lot,2));
}
//+------------------------------------------------------------------+
المواضيع المتشابهه | ||||
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| طلب مساعدة من الاخوة المبرمجين | mmohy1 | منتدى المؤشرات و الاكسبرتات | 4 | 27 - 12 - 2015 09:33 AM |
| أحتاج مساعدة من الإخوان المبرمجين | babouche | منتدى المؤشرات و الاكسبرتات | 6 | 28 - 11 - 2015 03:02 PM |