last works ...

This commit is contained in:
2024-06-14 00:44:37 +03:30
parent 0fa788d126
commit a525a2e2cd
9 changed files with 2579 additions and 120 deletions
+14 -9
View File
@@ -36,24 +36,26 @@ int x121EASlippage = 10; // Slippgae
//
// Trading Symbols ...
string x121EASymbols = "EURUSDb"; // Symbols
input string x121EASymbols = "EURUSDb"; // Symbols
// EURUSDb,GBPUSDb,XAUUSDb,USDCHFb,USDJPYb
//
// Signals ...
bool x121EAAllowLong = true; // Allow Long Trades
bool x121EAAllowShort = true; // Allow Short Trades
int x121EAReuiredSignalVerifications = 5; // Required Verifications for Signals
int x121EAReuiredSignalVerifications = 4; // Required Verifications for Signals
//
// Risk Management ...
double x121EAVolume = 0.01; // Static Volume
double x121EATPPoint = 50; // TP Point
double x121EASLPoint = 500; // SL Point
int x121EAMaxAllowedTrades = 1; // Max Allowed Positions
bool x121EAIgnoreSL = false; // Ignore Calculated SL
bool x121EAIgnoreTP = false; // Ignore Calculated TP
bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
double x121EAVolume = 0.01; // Static Volume
double x121EATPPoint = 100; // TP Point
double x121EASLPoint = 500; // SL Point
int x121EAMaxAllowedTrades = 10; // Max Allowed Positions
bool x121EAIgnoreSL = false; // Ignore Calculated SL
bool x121EAIgnoreTP = false; // Ignore Calculated TP
bool x121EAUseSupport = true; // Use Support Signals
int x121EACloseOnSpecificTime = -1; // Close All Trades in Specific Time
bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
//
// Alert ...
@@ -167,7 +169,10 @@ bool InitialEA()
x121EA.IgnoreTP(x121EAIgnoreTP);
x121EA.AllowLong(x121EAAllowLong);
x121EA.AllowShort(x121EAAllowShort);
x121EA.UseSupport(x121EAUseSupport);
x121EA.CloseOnOpposit(x121EACloseOnOpposit);
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
x121EA.CloseOnSpecificTime(x121EACloseOnSpecificTime);
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
//
+263
View File
@@ -0,0 +1,263 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center XZoneTest MQL5 Expert Advisor
// -------------------------------------------------
// Name: XZoneTest
// Description: an Exper Advisor which used RSI and MA
// to Analyse Market ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////x
//
// Global Properties ...
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XZoneTest"
#property strict
//
#include "../Classes/x-saherelm.xczone.class.mq5"
//
#define ShortName "XZoneTest"
//
// Inputs ...
input int zoneRange = 21;
input ENUM_TIMEFRAMES zonePeriod = PERIOD_M1;
//
// Variables ...
int barsTotal;
//
// Initialization ...
int OnInit()
{
//
if (!InitialEA())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// Init Succeed ...
return INIT_SUCCEEDED;
}
//
// DeInitialization ...
void OnDeinit(const int reason)
{
//
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
// REASON_REMOVE 1 Program removed from a chart
// REASON_RECOMPILE 2 Program recompiled
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
// REASON_CHARTCLOSE 4 Chart closed
// REASON_PARAMETERS 5 Inputs changed by a user
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
// REASON_TEMPLATE 7 Another chart template applied
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
// REASON_CLOSE 9 Terminal closed
//
// De Initialize XSampleEA Providers ...
}
//
// On Tick Handler ...
void OnTick()
{
//
int bars = iBars(
_Symbol,
zonePeriod //
);
if (barsTotal == bars)
{
return;
}
//
barsTotal = bars;
//
datetime startTime = iTime(
_Symbol,
zonePeriod,
zoneRange + 1 //
);
datetime endTime = iTime(
_Symbol,
zonePeriod,
1 //
);
//
MqlTick ticks[];
CopyTicksRange(
_Symbol,
ticks,
COPY_TICKS_ALL,
startTime * 1000,
endTime * 1000 //
);
//
double highs[];
CopyHigh(
_Symbol,
zonePeriod,
startTime,
endTime,
highs //
);
double iHigh = highs[ArrayMaximum(highs)];
//
double lows[];
CopyLow(
_Symbol,
zonePeriod,
startTime,
endTime,
lows //
);
double iLow = lows[ArrayMinimum(lows)];
//
double iSize = iHigh - iLow;
//
CArrayObj zones;
int zCount = 10;
for (int i = 0; i < zCount; i++)
{
//
double iH = iHigh - iSize * i / zCount;
double iL = iHigh - iSize * (i + 1) / zCount;
//
XSCZone *iZone = new XSCZone();
iZone.high = iH;
iZone.low = iL;
//
zones.Add(iZone);
}
//
// Fill Ticks ...
for (int i = 0; i < ArraySize(ticks); i++)
{
//
MqlTick iTick = ticks[i];
//
for (int j = 0; j < zones.Total(); j++)
{
//
XSCZone *jZone = zones.At(j);
//
bool isInRange = iTick.bid >= jZone.low && iTick.bid <= jZone.high;
if (isInRange)
{
//
jZone.ticks++;
break;
}
}
}
//
// Sorting Zones ...
zones.Sort();
//
CArrayObj mChartObjects;
for (int i = 0; i < zones.Total(); i++)
{
//
XSCZone *iZone = zones.At(i);
//
string iZoneName = "Zone " + IntegerToString(i);
//
// Create Zone Rectangle ...
CChartObjectRectangle *iRect = new CChartObjectRectangle();
iRect.Create(
0,
iZoneName,
0,
startTime,
iZone.high,
endTime,
iZone.low //
);
iRect.Fill(true);
//
// Create Zone Label ...
CChartObjectLabel *iLabel = new CChartObjectLabel();
iLabel.Create(
0,
iZoneName + "_lbl",
0,
startTime,
iZone.high //
);
iLabel.Color(clrWhite);
//
// Calculate TickPercent ...
double iZoneTickPercent = (double)iZone.ticks / ArraySize(ticks) * 100;
iZoneTickPercent = NormalizeDouble(iZoneTickPercent, 2);
string iZoneTickPercentStr = (string)iZoneTickPercent + "%";
//
iLabel.Description(iZoneTickPercentStr);
//
if (iZone.ticks > ArraySize(ticks) * 0.15)
{
iRect.Color(clrOrangeRed);
}
else if (iZone.ticks > ArraySize(ticks) * 0.10)
{
iRect.Color(clrOrange);
}
else
{
iRect.Color(clrLightGray);
}
//
// mChartObjects.Add(iRect);
// mChartObjects.Add(iLabel);
}
}
//
//
//
bool InitialEA()
{
//
bool result = false;
//
result = true;
//
return result;
}
//