Files
MQL5Data/Experts/x-nn-test.mq5
T
2024-06-15 09:00:03 +03:30

149 lines
2.8 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center XNNTest MQL5 Expert Advisor
// -------------------------------------------------
// Name: XNNTest
// 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 XNNTest"
#property strict
//
#include "../Classes/x-saherelm.xczone.class.mq5"
//
#define ShortName "XNNTest"
//
// Inputs ...
input group "Weights";
input double w0 = 0.5;
input double w1 = 0.5;
input double w2 = 0.5;
input double w3 = 0.5;
input double w4 = 0.5;
input double w5 = 0.5;
input double w6 = 0.5;
input double w7 = 0.5;
input double w8 = 0.5;
input double w9 = 0.5;
//
// Variables ...
int barsTotal;
//
string mSymbol;
double mVolume;
ENUM_TIMEFRAMES mPeriod;
//
// This is our Data Provider ...
int rsiHandler = INVALID_HANDLE;
double rsi[];
//
double inputs[]; // Storing Inputs
double weights[]; // Storing Weights;
//
double output; // Output Neuron Value
//
// 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,
_Period //
);
if (barsTotal == bars)
{
return;
}
//
barsTotal = bars;
}
//
// Custom Functions ...
//
bool InitialEA()
{
//
bool result = false;
//
mSymbol = _Symbol;
mPeriod = _Period;
//
// Initialize RSI Handler ...
rsiHandler = iRSI(
mSymbol,
mPeriod,
14,
PRICE_CLOSE //
);
result = rsiHandler != INVALID_HANDLE;
if (!result) {
return result;
}
//
result = true;
//
return result;
}
//