I have an algorithm which is based on candlestick formations - specifically the hammer candle formation.
Previously, the algorithm only executed short positions on bearish hammers & long positions on bullish hammers.
Now, however, I'm wanting to introduce inverse hammers, but keeping the wicks in the same positions (i.e., extended lower wicks for short positions and extended upper wicks for long positions)
It's not so much the interpretations of the global & local declarations themselves that are the issue, but it's the placement of the brackets that needs to be altered, as well as maybe introducing the "OR" or "ELSE IF" logic but I'll leave that up to you.
The instructions I'm needing it to follow - in layman’s terms - is the following:
"If '(BarTime != Time[0])' is true,
then assess if '(hammerHeadClose < hammerHeadOpen)' is True.
If (hammerHeadClose < hammerHeadOpen) is True, then assess if all of it's child statements are true.
If all of its child statements are also True, then execute a position.
Alternatively (OR/ELSE IF) if '(hammerHeadClose > hammerHeadOpen)' is true,
then assess if all of it's child statements are true.
If all of its child statements are true, then execute a position”.
Therefore, if(BarTime != Time[0]) must always be TRUE, but dependant on weather '(hammerHeadClose < hammerHeadOpen)' or '(hammerHeadClose > hammerHeadOpen)' will determine which set of child statements will be assessed to determine if a poition should be open.
Obviously (hammerHeadClose > hammerHeadOpen) & (hammerHeadClose < hammerHeadOpen) are mutually exclusive criteria (the closing price can either be above the opening or below the opening - doji's aren't allowed), there is no point in the EA assessing the child statements under (hammerHeadClose > hammerHeadOpen) when (hammerHeadClose < hammerHeadOpen) and visa-versa.
To put it another way "if(BarTime != Time[0]), assess "if(hammerHeadClose > hammerHeadOpen)".
If "if(hammerHeadClose > hammerHeadOpen)" is FALSE (for example), go straight to if(hammerHeadClose < hammerHeadOpen) and assess all child statements here".
I hope this helps, if you need any clarification, let me know.
The code in question is on line 315 (short position criteria) and line 795 (long position criteria).
I have enclosed documentation for the EA which includes the explanations to the Global Declarations which you will come across.
if(BarTime != Time[0])
{
if((hammerHeadClose < hammerHeadOpen)
&& (bearHammerHead >= Transform(candleBodyLength,2))
&& (bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
&& (bullRetracementCandle!=0 && (bearHammerHead / bullRetracementCandle) <= hammerHeadPct)
&& (bullRetracementCandle!=0 && (initialTrendBearCandle / bullRetracementCandle) <= retracePercentage)
&& (bullRetracementCandle >= Transform(candleBodyLength,2))
&& (trendFast < trendSlow)
&& (momentumFast < momentumSlow)
&& (NewBar)
&& (spread <= MaxSpread)
&& (hourOfDay >= startingHour && hourOfDay < endingHour)
&& (OrdersTotal()== 0))
if((hammerHeadClose > hammerHeadOpen)
&& (bullHammerHead >= Transform(candleBodyLength,2))
&& (bearHammerHandleInv!=0 && (bullHammerHead / bearHammerHandleInv) <= hammerHandlePct)
&& (bullRetracementCandle!=0 && (bullHammerHead / bullRetracementCandle) <= hammerHeadPct)
&& (bullRetracementCandle!=0 && (initialTrendBearCandle / bullRetracementCandle) <= retracePercentage)
&& (bullRetracementCandle >= Transform(candleBodyLength,2))
&& (trendFast < trendSlow)
&& (momentumFast < momentumSlow)
&& (NewBar)
&& (spread <= MaxSpread)
&& (hourOfDay >= startingHour && hourOfDay < endingHour)
&& (OrdersTotal()== 0))
{
bool OpenShort = OrderSend(.....);
}
}
비슷한 주문
Hi there I need someone who can create an ea that calculate the next price movement points if it greater then the spread cost using atr,ema, it must place an dead order meaning if the market touches it , it dead only actives in profits message of me if you understand, or if you can create it
أبحث عن مطور MQL5 ذي خبرة لإنشاء مستشار خبير (EA) مخصص يعتمد على استراتيجية محددة لتتبع الاتجاهات مع إدارة صارمة للمخاطر. 1. متطلبات استراتيجية التداول: - مرشح الاتجاه: استخدم المتوسط المتحرك الأسي (EMA) لمدة 200 فترة على الإطار الزمني H1. * افتح صفقات الشراء فقط إذا كان السعر أعلى من المتوسط المتحرك الأسي 200. * افتح صفقات البيع فقط إذا كان السعر أقل من المتوسط المتحرك الأسي 200. - إشارة الدخول: استخدم مؤشر
//+------------------------------------------------------------------+ //| ModularMultiStrategy.mq5 | //| Copyright 2026, Financial Algo | //| https://mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026" #property link " https://mql5.com " #property version "1.00" #property strict //---
Custom MT5 Expert Advisor – Developer Specification 1. Project Objective Develop a fully autonomous, custom MetaTrader 5 Expert Advisor (EA) using native MQL5. The EA must independently analyze financial markets, generate its own trading signals, evaluate opportunities, execute trades, and manage open positions without requiring an external signal provider, another trading bot, or manual intervention. The EA must
I want to have a own strategy tester like the one in MQL5 But I want a new one my own tester Because I need to test many EA related each to other on the same time .and I want to have a replay to see the past history minute by minute on a panel
Hello guys, I want to create a gold (xauusd)trading bot. The account balance would be €30 or €50—essentially a bot designed for a "cent account" using fixed lots, starting at a minimum lot size of 0.01. It should be a scalping bot capable of generating a daily profit of €2,000 to €3,000. As the capital grows, the lot size can be increased manually, which would, in turn, increase the profits. Is there anyone who can
Description: Hello, I need a professional, high-quality optimization of the"Ultimate SMC" Expert Advisor for MetaTrader 5. The primary objective is to create robust and safe configuration files(.set files) tailored specifically to pass the Funding Pips prop firm challenge using a cosnservative risk model. Assets and Timeframes:1.Currency Pairs: EURUSD and GBPUSD (Upon completion, I require 2 separate,independent .set
Title: Create a Combined Indicator from 3 EX4 Indicators + Fully Automatic Trading EA (MT4) Description: Hello, I need an experienced MQL4 developer to build a custom trading system based on 3 existing .ex4 indicators. Project Requirements: Combined Custom Indicator: Read and merge signals from 3 specified .ex4 indicators via buffer reading (iCustom). Generate a consolidated BUY or SELL arrow/signal
I need a robot that trade on command and stop-loss and take profit when need to , able to trade on all plate form follow profitable strategies or signal , want a winning streak with fast profits making
Hi I'm looking for this EA or Similar EA with optimizated set file. This bot is an automated trading robot, operating 24/7, and capable of trading all currency pairs. Compatible with all brokers. Features: Analysis of price action charts, trends, and support and resistance levels on any timeframe. The bot integrates stop-loss (SL), stop-loss (TP), and trailing stop-loss (SL) orders. Works on MT5 getshared . c o m