2026-07-13 03:23:39 -04:00
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Warrior_EA |
|
|
|
|
|
//| AnimateDread |
|
|
|
|
|
//| |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
#include "..\Expert\ExpertSignalAIBase.mqh"
|
|
|
|
|
// wizard description start
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Description of the class |
|
|
|
|
|
//| Title=Signals of indicator 'LSTM AI' |
|
|
|
|
|
//| Type=SignalAdvanced |
|
|
|
|
|
//| Name=LSTM AI |
|
|
|
|
|
//| ShortName=LSTM |
|
|
|
|
|
//| Class=CSignalLSTM |
|
|
|
|
|
//| Page=signal_lstm |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
// wizard description end
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Class CSignalLSTM. |
|
|
|
|
|
//| Purpose: Class of generator of trade signals based on |
|
|
|
|
|
//| the 'LSTM AI' indicator. |
|
|
|
|
|
//| Is derived from the CExpertSignalAIBase class. |
|
|
|
|
|
//| Only the network topology differs from the other AI signals: an |
|
|
|
|
|
//| input layer feeds a single LSTM layer before the common tapering |
|
|
|
|
|
//| hidden-layer stack (see AddCustomLayers). |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
class CSignalLSTM : public CExpertSignalAIBase
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool AddCustomLayers(CArrayObj *topology) override;
|
2026-07-14 22:36:27 -04:00
|
|
|
//--- keep the tapering Dense stack TANH-bounded, matching the LSTM layer's own bounded
|
|
|
|
|
//--- output, instead of the base class's default PRELU (see the base declaration's comment)
|
|
|
|
|
virtual ENUM_ACTIVATION HiddenLayerActivation(void) override { return TANH; }
|
2026-07-13 03:23:39 -04:00
|
|
|
public:
|
|
|
|
|
CSignalLSTM(void);
|
|
|
|
|
//--- method of creating the indicator and timeseries
|
|
|
|
|
virtual bool InitIndicators(CIndicators *indicators) override;
|
|
|
|
|
};
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Constructor |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
CSignalLSTM::CSignalLSTM(void)
|
|
|
|
|
{
|
2026-07-22 13:33:56 -04:00
|
|
|
SetIdentity("LSTM", "LSTM");
|
2026-07-13 03:23:39 -04:00
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Create indicators and bootstrap/load the network. |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
bool CSignalLSTM::InitIndicators(CIndicators *indicators)
|
|
|
|
|
{
|
|
|
|
|
return InitNeuralNetwork(indicators);
|
|
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| LSTM layer inserted between the input layer and the common |
|
|
|
|
|
//| tapering hidden-layer stack. |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
bool CSignalLSTM::AddCustomLayers(CArrayObj *topology)
|
|
|
|
|
{
|
2026-07-29 00:38:05 -04:00
|
|
|
return AddLstmStage(topology);
|
2026-07-13 03:23:39 -04:00
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|