83 lines
1.4 KiB
Plaintext
83 lines
1.4 KiB
Plaintext
#ifndef EA_ICT_CL__STATE_MQH
|
|
#define EA_ICT_CL__STATE_MQH
|
|
|
|
enum EAState
|
|
{
|
|
EA_IDLE,
|
|
EA_WAIT_TOUCH,
|
|
EA_WAIT_TRIGGER,
|
|
EA_IN_TRADE
|
|
};
|
|
|
|
enum MarketDir { DIR_NONE=0, DIR_UP=1, DIR_DOWN=-1 };
|
|
enum BlockReason
|
|
{
|
|
BLOCK_NONE, BLOCK_SESSION, BLOCK_DAILY_LOSS, BLOCK_NO_TREND
|
|
};
|
|
enum FVGStatus
|
|
{
|
|
FVG_PENDING,
|
|
FVG_TOUCHED,
|
|
FVG_USED
|
|
};
|
|
|
|
struct TFTrendContext
|
|
{
|
|
MarketDir trend;
|
|
double h0, h1, l0, l1;
|
|
int idxH0, idxH1, idxL0, idxL1;
|
|
double keyLevel;
|
|
datetime lastBarTime;
|
|
|
|
datetime lastMssTime;
|
|
double lastMssLevel;
|
|
MarketDir lastMssBreak;
|
|
double mssSLSwing;
|
|
};
|
|
|
|
struct FVGRecord
|
|
{
|
|
int id;
|
|
FVGStatus status;
|
|
int usedCase;
|
|
MarketDir direction;
|
|
double high, low, mid;
|
|
datetime createdTime;
|
|
datetime touchTime;
|
|
datetime usedTime;
|
|
MarketDir triggerTrendAtTouch;
|
|
|
|
datetime mssTime;
|
|
double mssEntry;
|
|
double mssSL;
|
|
};
|
|
|
|
struct OrderPlan
|
|
{
|
|
bool valid;
|
|
int direction;
|
|
double entry, stopLoss, takeProfit, lot;
|
|
int parentFVGId;
|
|
};
|
|
|
|
struct OrderHistRecord
|
|
{
|
|
int id;
|
|
int direction;
|
|
double entry, stopLoss, takeProfit, lot;
|
|
datetime signalTime;
|
|
datetime closeTime; // 0 nếu đang active
|
|
int result; // 0=active, 1=TP hit, -1=SL hit, 2=cancelled
|
|
double profit;
|
|
int parentFVGId;
|
|
};
|
|
|
|
struct DailyRiskContext
|
|
{
|
|
double startBalance, currentBalance;
|
|
datetime dayStartTime;
|
|
bool limitHit;
|
|
};
|
|
|
|
#endif
|