last ...
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| X121_Strategy_EA.mq5 |
|
||||
//| Copyright 2023, SaherElm IT |
|
||||
//| https://saherelm.ir/ |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "EA based on X121 XCZone indicators"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Include Common Library ...
|
||||
#include "../Libraries/x-saherelm.common.lib.mq5"
|
||||
#include "../XCAEA/Helpers/xcaea.helper.mq5"
|
||||
#include "../XCAEA/Libraries/xcaea.trigger.block.lib.mq5"
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
|
||||
//
|
||||
// Variables ...
|
||||
XCAEAInputs eaInputs;
|
||||
XCXCAEAHelper *eaHelper;
|
||||
XBarTracker eaBarTraker;
|
||||
|
||||
//
|
||||
CArrayObj *eaObjects;
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnInit()
|
||||
{
|
||||
//
|
||||
// Initial Bar Tracker ...
|
||||
eaBarTraker.Init(
|
||||
_Symbol,
|
||||
_Period //
|
||||
);
|
||||
|
||||
//
|
||||
// Objects ...
|
||||
eaObjects = new CArrayObj();
|
||||
|
||||
//
|
||||
// Configure XCA ...
|
||||
eaInputs.Default();
|
||||
|
||||
//
|
||||
// Hide all Visible Buffers ...
|
||||
eaInputs.Hide();
|
||||
|
||||
//
|
||||
// we Can make Show all requirements here ...
|
||||
eaInputs.caInputs.showSar = false;
|
||||
|
||||
//
|
||||
eaHelper = new XCXCAEAHelper();
|
||||
bool isInited = eaHelper.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
eaInputs //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return (INIT_FAILED);
|
||||
}
|
||||
|
||||
//
|
||||
return (INIT_SUCCEEDED);
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert deinitialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//
|
||||
// eaObjects.Clear();
|
||||
|
||||
//
|
||||
eaBarTraker.Clean();
|
||||
|
||||
//
|
||||
delete eaHelper;
|
||||
ZeroMemory(eaHelper);
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert tick function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTick()
|
||||
{
|
||||
//
|
||||
// Check Bar Processing ...
|
||||
if (!eaBarTraker.CanProcessBar())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
// Retrieve Bars ...
|
||||
XOHCL zBar;
|
||||
XOHCL cBar;
|
||||
has = zBar.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
0 //
|
||||
);
|
||||
has =
|
||||
has &&
|
||||
zBar.GetPreviousBar(cBar);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Do What we Want ...
|
||||
// When we Need Waits Until Next Bar ...
|
||||
eaBarTraker.Waits();
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
}
|
||||
Reference in New Issue
Block a user