محمدي.
14-08-2021, 05:05 AM
السلام عليكم أستاذنا تعديل بسيط لهذا المؤشر يقول لي قوس فيه خطأ أو قوسين أرجو شاكرا التعديل مع الشكر
//+------------------------------------------------------------------+//| Indicator: HAK.mq4 |
//| Created with EABuilder.com |
//| https://www.eabuilder.com |
//+------------------------------------------------------------------+
#property copyright "Created with EABuilder.com"
#property link "https://www.eabuilder.com"
#property version "1.00"
#property description ""
#include <stdlib.mqh>
#include <stderror.mqh>
//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_type1 DRAW_ARROW
#property indicator_width1 5
#property indicator_color1 0x00FFD5
#property indicator_label1 "Buy"
//--- indicator buffers
double Buffer1[];
double myPoint; //initialized in OnInit
void myAlert(string type, string message)
{
if(type == "print")
Print(message);
else if(type == "error")
{
Print(type+" | HAK @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
}
else if(type == "order")
{
}
else if(type == "modify")
{
}
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
IndicatorBuffers(1);
SetIndexBuffer(0, Buffer1);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexArrow(0, 241);
//initialize myPoint
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
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[])
{
int limit = rates_total - prev_calculated;
//--- counting from 0 to rates_total
ArraySetAsSeries(Buffer1, true);
//--- initial zero
if(prev_calculated < 1)
{
ArrayInitialize(Buffer1, EMPTY_VALUE);
}
else
limit++;
//--- main loop
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
//Indicator Buffer 1
if iMACD(NULL, PERIOD_CURRENT, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, i) >= 0
&& Close[i] > iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_MAIN, i)
&& iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 1+i) <= 54
&& Close[1+i] >= Open[1+i]
&& Close[i] >= Open[i]
&&
(
(
(
iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i) - iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i
)
< 0.40
&& Close[i] > 13
)
||
(
(
iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i) - iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i)
)
< 0.20
&& Close[i] < 13) //Custom Code
{
Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low
}
else
{
Buffer1[i] = EMPTY_VALUE;
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+//| Indicator: HAK.mq4 |
//| Created with EABuilder.com |
//| https://www.eabuilder.com |
//+------------------------------------------------------------------+
#property copyright "Created with EABuilder.com"
#property link "https://www.eabuilder.com"
#property version "1.00"
#property description ""
#include <stdlib.mqh>
#include <stderror.mqh>
//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_type1 DRAW_ARROW
#property indicator_width1 5
#property indicator_color1 0x00FFD5
#property indicator_label1 "Buy"
//--- indicator buffers
double Buffer1[];
double myPoint; //initialized in OnInit
void myAlert(string type, string message)
{
if(type == "print")
Print(message);
else if(type == "error")
{
Print(type+" | HAK @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
}
else if(type == "order")
{
}
else if(type == "modify")
{
}
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
IndicatorBuffers(1);
SetIndexBuffer(0, Buffer1);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexArrow(0, 241);
//initialize myPoint
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
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[])
{
int limit = rates_total - prev_calculated;
//--- counting from 0 to rates_total
ArraySetAsSeries(Buffer1, true);
//--- initial zero
if(prev_calculated < 1)
{
ArrayInitialize(Buffer1, EMPTY_VALUE);
}
else
limit++;
//--- main loop
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
//Indicator Buffer 1
if iMACD(NULL, PERIOD_CURRENT, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, i) >= 0
&& Close[i] > iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_MAIN, i)
&& iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 1+i) <= 54
&& Close[1+i] >= Open[1+i]
&& Close[i] >= Open[i]
&&
(
(
(
iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i) - iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i
)
< 0.40
&& Close[i] > 13
)
||
(
(
iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i) - iBands(NULL, PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i)
)
< 0.20
&& Close[i] < 13) //Custom Code
{
Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low
}
else
{
Buffer1[i] = EMPTY_VALUE;
}
}
return(rates_total);
}
//+------------------------------------------------------------------+