Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Do you know how to code in MQL?
You are including a header file within the middle of a function body, and defining "#property" statements within a function body too.
It does not seem you understand how to code and are only doing "copy/paste" without regard for the context.
// Expert initialization function int OnInit() { // Set the copyright text dynamically CopyrightText = "Gregory Delazeri Copyright " + IntegerToString(TimeYear(TimeLocal())); // Set the yearly copyright property CopyrightYearly = "Gregory Delazeri Copyright " + IntegerToString(TimeYear(TimeLocal())); // Other properties #property copyright CopyrightYearly #property link "" #property version "1.00" #property strict // Include the CustomFunctions.mqh file #include "CustomFunctions.mqh" // Initialization code here // For example: Initialize variables, set up indicators, or connect to external systems return (INIT_SUCCEEDED); }
- Fernando Carreiro #: You are including a header file within the middle of a function body, and defining "#property" statements within a function body too.
That's one. You can't define functions withing other functions.
-
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnTicks() {
You define a new function but never call it.
-
stopLoss = entryPrice - pips * GetPipValue(); } else { stopLoss = entryPrice + pips * GetPipValue();
A PIP does not have a value, it is a unit of distance. Only distance times lots has a value. You want the size of a PIP.
PIP, Point, or Tick are all different in general.
Ticks, PIPs or points in the GUI. Make up your mind. - MQL4 programming forum #1 (2014)
Percentage in point - WikipediaUnless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers (if any still exists), exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a logical PIP is and use that, not points.
How to manage JPY pairs with parameters? - MQL4 programming forum (2017)
Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018) -
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes.
My GBPJPY shows average spread = 26 points, average maximum spread = 134.
My EURCHF shows average spread = 18 points, average maximum spread = 106.
(your broker will be similar).
Is it reasonable to have such a huge spreads (20 PIP spreads) in EURCHF? - General - MQL5 programming forum (2022)
-

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
FX Bot File
Perhaps I have some unnecessary code here? ^^ but i am getting these errors i am struggling to fix
- 'CustomFunctions' - import not defined Ignite FX Automated Trader Robot.mq4 79 54
- }' - semicolon expected Ignite FX Automated Trader Robot.mq4 80 5
- 'CustomFunctions' - some operator expected Ignite FX Automated Trader Robot.mq4 79 54
- 'else' - illegal 'else' without matching 'if' Ignite FX Automated Trader Robot.mq4 80 7
- can't open "C:\Program Files (x86)\MetaTrader 4\MQL4\Experts\CustomFunctions.mqh" include file Ignite FX Automated Trader Robot.mq4 29 11
My Custom Functions file (no issues detected)