Specification
I want a EA that I can apply to a chart and it will evaluate the historical date using deepsaeek(deep thinks) ai but I want itnto take trade using the methodology in a pdf that I have https://acrobat.adobe.com/id/urn:aaid:sc:VA6C2:eaacada6-568e-4c5e-8574-9c423609413f . But I also want it to be some type of box to be able to type and talk to the ai while one the chart. https://github.com/deepseek-ai/DeepSeek-V3
Also I have a base
//+------------------------------------------------------------------+
//| WyckoffEA.mq5 |
//| Copyright 2023, Based on Wyckoff Method |
//+------------------------------------------------------------------+
#property copyright "Wyckoff MT5 EA"
#property version "1.00"
#property strict
#include <Trade\Trade.mql5>
CTrade trade;
// Input Parameters
input double RiskPercent = 1.0; // Risk per trade (%)
input int ATRPeriod = 14; // ATR Period
input int MinRangeBars = 20; // Min range bars
input double VolumeMulti = 2.0; // Volume multiplier
input int TrendMA = 200; // Trend MA period
// Global Variables
double lotSize;
ulong magicNumber = 20231001;
int atrHandle;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
atrHandle = iATR(_Symbol, _Period, ATRPeriod);
trade.SetExpertMagicNumber(magicNumber);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(Bars(_Symbol, _Period) < 100 || !IsTradeAllowed()) return;
CheckForWyckoffSignals();
}
//+------------------------------------------------------------------+
//| Main Wyckoff Logic Controller |
//+------------------------------------------------------------------+
void CheckForWyckoffSignals()
{
MqlRates rates[];
CopyRates(_Symbol, _Period, 0, 5, rates);
// Check existing positions
if(PositionSelect(_Symbol)) return;
// Detect Accumulation Pattern
if(IsAccumulationPhase(rates))
{
double springLow = DetectSpringLow(rates);
double entry = rates[0].close;
double sl = springLow - GetATRValue();
double tp = entry + (entry - sl) * 3; // 1:3 RR
if(entry > sl && entry - sl > _Point * 10)
ExecuteTrade(ORDER_TYPE_BUY, entry, sl, tp);
}
// Detect Distribution Pattern (similar structure)
// ...
}
//+------------------------------------------------------------------+
//| Accumulation Phase Detection |
//+------------------------------------------------------------------+
bool IsAccumulationPhase(MqlRates &rates[])
{
// Check market context
if(!IsDowntrend()) return false;
if(!IsTradingRange(MinRangeBars)) return false;
// Check Spring characteristics
if(rates[1].low < rates[2].low &&
rates[1].close > (rates[1].high + rates[1].low)/2 &&
IsVolumeSpike(rates[1].tick_volume))
{
// Confirm SOS
if(IsSignOfStrength(rates[0]))
return true;
}
return false;
}
//+------------------------------------------------------------------+
//| Volume Spike Detection |
//+------------------------------------------------------------------+
bool IsVolumeSpike(long volume)
{
long avgVolume[];
CopyBufferTickVolume(_Symbol, _Period, 0, 20, avgVolume);
double avg = 0;
for(int i=0; i<20; i++) avg += avgVolume[i];
avg /= 20;
return volume > (avg * VolumeMulti);
}
//+------------------------------------------------------------------+
//| Sign of Strength Detection |
//+------------------------------------------------------------------+
bool IsSignOfStrength(MqlRates ¤tRate)
{
double bodySize = currentRate.close - currentRate.open;
double candleRange = currentRate.high - currentRate.low;
return (bodySize > candleRange * 0.7) &&
(currentRate.close > currentRate.open) &&
IsVolumeSpike(currentRate.tick_volume);
}
//+------------------------------------------------------------------+
//| Trade Execution |
//+------------------------------------------------------------------+
void ExecuteTrade(ENUM_ORDER_TYPE type, double price, double sl, double tp)
{
double riskAmount = AccountInfoDouble(ACCOUNT_BALANCE) * RiskPercent / 100;
double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
double pointValue = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
double riskPips = MathAbs(price - sl) / pointValue;
lotSize = (riskAmount / (riskPips * tickValue));
lotSize = NormalizeDouble(lotSize, 2);
trade.PositionOpen(_Symbol, type, lotSize, price, sl, tp, "Wyckoff Accumulation");
}
//+------------------------------------------------------------------+
//| ATR Value Getter |
//+------------------------------------------------------------------+
double GetATRValue()
{
double atr[];
CopyBuffer(atrHandle, 0, 0, 1, atr);
return atr[0];
}
//+------------------------------------------------------------------+
//| Trend Detection |
//+------------------------------------------------------------------+
bool IsDowntrend()
{
double ma[];
CopyBuffer(iMA(_Symbol, _Period, TrendMA, 0, MODE_SMA, PRICE_CLOSE), 0, 0, 2, ma);
return Close(1) < ma[1] && Close(0) < ma[0];
}
//+------------------------------------------------------------------+
//| Range Detection |
//+------------------------------------------------------------------+
bool IsTradingRange(int bars)
{
double highs[], lows[];
CopyHigh(_Symbol, _Period, 0, bars, highs);
CopyLow(_Symbol, _Period, 0, bars, lows);
double rangeHigh = highs[ArrayMaximum(highs)];
double rangeLow = lows[ArrayMinimum(lows)];
return (rangeHigh - rangeLow) < (GetATRValue() * 2);
}