Expert Advisors and Automated Trading - page 87

I want to make a trail system that will only do trail once or for a specified number of times. Can you guide me how to do this
Guys please take a look at this. This line of code is supposed to count all the positions and return the number of open positions... It does so perfectly. But then I added, if the number of positions is > 5 then don't open positions stt = 5 The problem is that it just goes ahead to open multiple
Are SYMBOL_VOLUME_STEP and SYMBOL_VOLUME_MIN ever different? I have never seen an instrument where the minimum volume wasn't the same as the volume step value. Did you ever see an example where it wasn't the same? Do you think it's possible even though you might have never seen it
Dear experts, How can I position my BUTTON object dynamically on chart in a way that when chart size changes or MT5 window is resized I can still see the buttons at the left most side of my chart (st like like Aligned left compared to chart window). I create my BUTTON object with below code now and
the code above erects this help box but when something is passed to it it throws an error. Just curious to what its supposed to do void print_type( void *& params[]){ } int OnInit () { //--- int h[]={ 1 , 2 , 3 }; print_type(); //--- return ( INIT_SUCCEEDED ); }
I feel weird asking this question.. but somehow I have an EA (Mt5) which seems to 'lose' trades. I've been trying to find a problem for the last few days and not getting any nearer. It's almost as if there is an EA deleting trades! I created the small routine below which just checks the positions I
#include <Trade\Trade.mqh> CTrade trade; input int TrailingPoints = 1000 ; input int TslTriggerPoints = 2000 ; int OnInit () { return ( INIT_SUCCEEDED ); } void OnDeinit ( const int reason) { } void OnTick () { double Ask= NormalizeDouble ( SymbolInfoDouble ( _Symbol , SYMBOL_ASK
A short overview: This issue was reported on "Metatrader Questions and Answers" end of November 2022. This is the original description, I posted back then: " Alexey, I have found a very strange behaviour concerning the compilers optimization. I hope you can give some insigt to this, as it is to my
Code explains it : #define NAMEOF(x) #x template < typename X> string findName(X &value){ return (NAMEOF(value)); } int OnInit () { //--- int macaroni= 0 ; string name=findName(macaroni); Print (name); //--- return(INIT_SUCCEEDED); } i expected that i'd get "value" can i get "macaroni" ? tx
Hi guys, i have created this strategy which is executing one trade a day, the idea here is to buy when the overall trend is bullish and sell when the overall trend is bearish. The issue is, that the bot aint buying, its only selling.... its also selling when the trend is bullish. I tried a lot but
I'm creating basic EA, using SAR. The problem is when the direction of SAR changes i get strange values of SAR. Working of advisor: When SAR changes its direction, it detects whether it goes up or down, and open trade. int OnInit() { . . . sarHandle = iSAR(_Symbol,PERIOD_M1,0.02,0.2); . . . } void
Hi everyone! I would like to know if it is possible using the library ( user32.dll ) to be able to make market entries by making the Expert press the Buy/Sell in the graph window, as shown in the image. Instead of doing an OrderSend() within the code to have it press the Buy or Sell in "One CLick
hello , i have this fuction to grow an array and return its latest element for immediate access : //expand primitive array template < typename X> int expand_primitive_array(X &array[]){ ArrayResize (array, ArraySize (array)+ 1 , 0 ); return ( ArraySize (array)- 1 ); } template < typename X> int
I rather quickly stumbled across a misconception that I have ignored for a while now, it is finally time to address it. My EA currently fires in a bunch of orders to scale in and out of trades, the problem is: I thought if I have i.e. 3 BUY orders open and I want to close one, I could simply place a
  expert stoploss  (2)
I want to write an expert that, when I set a specific price, whenever the market price reaches it, my positions will be closed (exactly similar to stop loss, with the difference that in stop loss, the set price is recorded in my broker, But in the expert, I want only this price to be determined in
  Martingale ea  (4)
Please I need to edit this ea by the following features Take profit points double the stoploss, start and close time to be added, option to choose the first trade to be manual or auto Also I have a problem when I manually close a trade the ae automatically open a doubled reverse trade
  What causes error on my EA?  (11   1 2)
Hi i programming EA and it is work correctly in demo account, But when i want run it on real account i get the error 10004 and 10021. I read this link "https://www.mql5.com/en/docs/constants/errorswarnings/enum_trade_return_codes" But the definition of some error is not clear and i do not understand
Hi all, I'm relatively new to coding, but can someone take a look at this code and tell my if there's a reason the trades aren't triggering in back testing? I'm getting no errors back from MetaEditor, and the defined variables are how I'd like them. Just not getting any trades lighting up in MT5
  VPS Error  (2)
Hello, I am using a MQL5 VPS and I keep getting this error message in my journal: 2023.04.26 16:42:04.960 Virtual Hosting 6461921: invalid zip archive of logs 2023.04.26 16:42:04.960 Virtual Hosting 6461921: invalid zip archive of logs (raw - read failed, 0 error, 1 bytes needed) I have cleared the
Hello, After some research, I was unable to find the solution to my problem. I explain, if someone has the solution, I'm interested :) On the SuperTrend indicator, ( see screen ), that I use for an EA, and I would just like to be able to keep the last 30 data of the supertrend (the red or green
Hello Guys ,, i ve tried to compile mq5 file and there was No compilation errors or warnings . The ea exist with the mq5 file in the same directory : Advisers ,, but when i try to test it , it does not start, i ve checked in the Journal and it said : EA NOT FOUND ! Need Help with this issue please
Dear experts, I have question on OnTick() event . Let's say OnTick() is triggered at every 1ms but the actions you perform inside OnTick() itself takes 5ms which is more than 1ms. What happens in such cases ? Do actions accumulate or happen in parallel or next action skipped as previous one is
i have this : float max_distance= MathSqrt (( float ) MathPow ((( float )px_per_side+ 1 ), 2.0 )* 2.0 ); and it raises this error : but it accepts it like this : float max_distance= 0.0 ; //float max_distance=MathSqrt((float)MathPow(((float)px_per_side+1),2.0)*2.0); double _mdd= MathSqrt ( MathPow
I have been trying to work with error 4806 and I am a newbie I hope someone can help me to fix it I declared the double indicator and in the compile they give absolutely no errors until I check the field value int OnInit () { MA_SET MA_1 = { 34 }; MA_SET MA_2 = { 89 }; MA_SET MA_3 = {
Hello world So I am using the iCustom function with an Heiken Ashi indicator I got on the market. I keep getting the error for incorrect input parameters [4002]. input group "Heiken Indicator inputs" input int heikenPeriod = 10 ; input ENUM_MA_METHOD MaMethod = MODE_EMA ; input color uptrendColor =
Hello, I have an EA that uses OrderSendAsync() to send multiple orders in batches and I collect the order ticket #s with code similar to the below code. When the EA only sends 1 order, it's always perfect, but if the EA sends 2 or 3 orders, about 9 times out of 10 everything is normal and I get one
Is it possible to substitute the data used by my MT5 tester to a particular csv file containing the bars data of my choice
Hi Team Metatrader5 have integrated python, I can see trade functions can be used. Is it possible to test strategy tester from python
I prefer to declare variables, structures and classes that I use in OnTick() globally (one time), rather than locally within OnTick(). I feel that it is more efficient and less time consuming considering that OnTick() is called so frequently. Yet I see that it is common practice to declare locally
  EA  (2)
I had tired to creating my first EA but i am getting the output even I am not getting the Comment and Alert so what is the solution