Forum on trading, automated trading systems and testing trading strategies
Sergey Golubev, 2018.04.10 16:07
- ZigZag For Long Term - expert for MetaTrader 4
- Random ZigZaG - expert for MetaTrader 4
- The adviser on the indicator ZigZag - expert for MetaTrader 4
- Fibo Retracement Trader - expert for MetaTrader 5
- DoubleZigZag - expert for MetaTrader 5
- ZigZagEvgeTrofi ver. 1 - expert for MetaTrader 5
- Last ZZ50 - expert for MetaTrader 5
- FMOneEA - expert for MetaTrader 4
- Aver4Sto+Postzigzag(Set-up for USDJPY only) - expert for MetaTrader 4
- e_RP_250 - expert for MetaTrader 5
- On the MaZi - expert for MetaTrader 4
- FX-CHAOS_SCALP - expert for MetaTrader 4
- Fractal ZigZag Expert - expert for MetaTrader 4
Fibo Retracement Trader - expert for MetaTrader 5
This simple Expert Advisor was created to illustrate the capabilities of trading the Fibonacci levels. The EA uses the standard ZigZag indicator (from the standard MetaTrader delivery) as the basis for placing the grid.
ZigZag EA - expert for MetaTrader 5
The EA applies data from the ZigZag custom indicator. This indicator is used to define the channel. Buy Stop and Sell Stop pending orders are placed along the channel borders. After a pending order is activated, trailing can be enabled for a position. Stop loss and take profit values are specified in Fibo levels (0.0%, 23.6%, 38.2%, 50%, 61.8%, 100%, 161.8%, 261.8% and 423.6%).
This is an English language forum.
Please only post in English.
I have used the translation tool to edit your initial post.
Bu bir İngilizce dili forumudur.
Lütfen sadece İngilizce olarak yazınız.
Çeviri aracını ilk yayınınızı yapabiliyor için kullandım.
thank you.
Yeah. needs to open an automated process
No ea good working to now
TRY THIS
//+------------------------------------------------------------------+ //| Zigzagy Auto Fibo EA.mq4 | //| Converted from Indicator to EA | //+------------------------------------------------------------------+ #property strict // Input parameters input int ExtDepth = 90; // ZigZag depth input int ExtDeviation = 5; // ZigZag deviation input int ExtBackstep = 3; // ZigZag backstep input double LotSize = 0.1; // Fixed lot size input int StopLoss = 100; // Stop loss in points input int TakeProfit = 200; // Take profit in points input bool UseFiboExpansion = true; // Use Fibo expansion for TP input double RiskPercent = 2.0; // Risk percentage per trade // Global variables double ZigzagBuffer[]; double HighMapBuffer[]; double LowMapBuffer[]; int lastTradeDirection = 0; // 1 = Buy, -1 = Sell, 0 = No trade //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { // Initialize buffers ArraySetAsSeries(ZigzagBuffer, true); ArraySetAsSeries(HighMapBuffer, true); ArraySetAsSeries(LowMapBuffer, true); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { // Clean up } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // Update ZigZag buffers UpdateZigZagBuffers(); // Get latest ZigZag points int pos1 = FindZigZagPoint(1); // Latest swing point int pos2 = FindZigZagPoint(2); // Previous swing point if (pos1 == -1 || pos2 == -1) return; // Not enough data // Calculate Fibonacci levels double high = HighMapBuffer[pos1]; double low = LowMapBuffer[pos2]; double fibo236 = low + (high - low) * 0.236; double fibo382 = low + (high - low) * 0.382; double fibo618 = low + (high - low) * 0.618; // Trading logic if (lastTradeDirection != 1 && Close[1] > fibo618) // Buy condition { OpenTrade(OP_BUY); lastTradeDirection = 1; } else if (lastTradeDirection != -1 && Close[1] < fibo382) // Sell condition { OpenTrade(OP_SELL); lastTradeDirection = -1; } } //+------------------------------------------------------------------+ //| Update ZigZag buffers | //+------------------------------------------------------------------+ void UpdateZigZagBuffers() { // Logic to update ZigZag, HighMap, and LowMap buffers // (Copy from the original indicator code) } //+------------------------------------------------------------------+ //| Find ZigZag point by index | //+------------------------------------------------------------------+ int FindZigZagPoint(int index) { int count = 0; for (int i = 0; i < Bars; i++) { if (ZigzagBuffer[i] != 0) { count++; if (count == index) return i; } } return -1; } //+------------------------------------------------------------------+ //| Open a trade | //+------------------------------------------------------------------+ void OpenTrade(int direction) { double sl = 0, tp = 0; double price = (direction == OP_BUY) ? Ask : Bid; // Calculate stop loss and take profit if (StopLoss > 0) sl = (direction == OP_BUY) ? price - StopLoss * Point : price + StopLoss * Point; if (TakeProfit > 0) tp = (direction == OP_BUY) ? price + TakeProfit * Point : price - TakeProfit * Point; // Use Fibo expansion for TP if enabled if (UseFiboExpansion) { double expansion = CalculateFiboExpansion(); tp = (direction == OP_BUY) ? price + expansion : price - expansion; } // Calculate lot size based on risk double lot = CalculateLotSize(StopLoss); // Open the trade int ticket = OrderSend(Symbol(), direction, lot, price, 3, sl, tp, "Zigzagy Auto Fibo EA", 0, 0, clrNONE); if (ticket < 0) Print("Error opening trade: ", GetLastError()); } //+------------------------------------------------------------------+ //| Calculate lot size based on risk | //+------------------------------------------------------------------+ double CalculateLotSize(int slPoints) { double riskAmount = AccountBalance() * RiskPercent / 100.0; double tickValue = MarketInfo(Symbol(), MODE_TICKVALUE); double lot = riskAmount / (slPoints * tickValue); return MathMin(lot, MarketInfo(Symbol(), MODE_MAXLOT)); } //+------------------------------------------------------------------+ //| Calculate Fibonacci expansion | //+------------------------------------------------------------------+ double CalculateFiboExpansion() { // Logic to calculate Fibo expansion (e.g., 161.8% of the prior wave) return 0.0; // Replace with actual calculation } //+------------------------------------------------------------------+

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use