Expert Advisors and Automated Trading - page 57

Hi, I want to store a position ticket in result of stop order has been filled. I already store the order ticket when opening stop order and when the order is filled I want to update the stored ticket to a position ticket. If I loop all the position and find the position for that symbol and that
Hello everyone, I'm encountering a peculiar issue with adjusting my Stop Loss in a trailing manner and am hoping someone can shed some light on this for me. Below is the function I use for trailing the Stop Loss: void CPM::TrailingStopLoss( string pSymbol, ulong pMagic, int pTSLFixedPoints) {
Dear all, I am new to trading and am developing my first strategies in MQL5. Up to now, I am only testing different strategies in Strategy Tester. Whenever I open a position, I am essentially buying, I only "go long", because "going short" is still a bit nebulous in my mind. Imagine I start with
Hello friends Please I'm trying to make my gui buttons work on MT5 backtest Below is the code I used Please help. Thanks long lparam = 0 ; double dparam = 0.0; string sparam = ""; sparam = "btnLines"; if( bool( ObjectGetInteger( 0, sparam, OBJPROP_STATE ) ) ) OnChartEvent(
  Compile  (3)
I needed to compile a script first and then a robot I give you the coded script Automatic translation applied by moderator
Hello. How do you know there is a deal already executing on a position so you do not request another deal on that position? (I am running a partial close on a position and I do not want to run another) Thanks
Alain Verleyen once wrote in another thread that some brokers provide the wrong value. I think my broker is doing this. What should I do? Should I tell them or should I change my code to adapt to it? What happens is the EA calculates lot sizes for a position based on the tick value returned by
  Signal EA  (1)
Hello All people. I just now entered into creating robot. I want to ask all you guys for help. I want to make robot that I can send signal of Buy or Signal of Sell to all my copies of the robot which I give to people and all the people's robot must take the buy or sell which I send out. I was
Hello all, I get two different tick formats when using CustomTicksAdd and CustomTicksReplace with the same tick array input. The funcion CustomTicksAdd for some reason does not show the decimal point at the correct position in the tick history and Market watch in MT5. For example: FUNCTION <BID>
  Unresolved Static Variable?  (15   1 2)
Hi guys, can anybody explain, what that sudden error is supposed to mean? My EA was working flawlessly for months, but since the latest update, I get this error. In my EA I just declare an array CMoneyManagement mms[]; and CMoneymanagement has one static variable. Whats wrong with that...
Hello everyone, I'm currently developing a GUI using the CAppDialog class in MQL4. My application has the capability to save and load its state, including all GUI controls, to and from a binary file. I use the Save method provided by CAppDialog for this. The issue I'm facing is related to dynamic
if ( (MovingAverage1[ 0 ]>MovingAverage2[ 0 ]) && (MovingAverage1[ 1 ]<MovingAverage2[ 1 ]) ) if ( PositionsTotal ()== 0 ) { OrderSend (request,result); else if ( PositionsTotal ()== 1 ); CloseAllOrders(); }
Hi all, I am trying to optimize my EA with with different timeframes as input. Here is how I change the TF within the code, where Timeframe is the input: int OnInit (){ ChartSetSymbolPeriod ( 0 , NULL , Timeframe); ... Then in my code I simply use Timeframe wherever I need it (just in iCustom
Short Version Question - please help! : I cannot see (on scan) my LAN strategy testers (on my other computers) despite enabling network discovery and disabling firewalls. What else is there to try? My earlier, longer description: I can't believe I can't find a solution to this, so maybe I have
I am testing out iCustom with my own indicator which is a simple MA with arrow signals (long and short signals based on how the market price moves over the MA). This indicator is not to be used as an EA in live scenario as the indicator has no risk management features and it is not making exit
Hello everyone, I notice that when collecting historical trades from a broker with Metatrader 5 Backtesting, the speed of collection is very different if the collection dates are older or more recent: If the dates are old, the data collection is very fast and if they are more recent, it is very
Hello, Thank you in advance for ANY help I can get on this -- I'm not a newbie and this has me perplexed. I have a simple calculation I've always used to calculate dollars per pip (account funded in USD) and it has always worked on all forex and metal symbols at multiple other brokers. Now at a new
Hi, I have 2 problems that i can´t solve. I hope you guys can help me work it out. Problem 1: I have an EA that works fine on demo account. It places trades and the profitability is very good. I let it run all day on demo account and it works like it should. But when i switch to real/live account,...
  EA Buying Order  (3)
I have created a simple robot (EA) that executes an order which opens a position and then closes that particular position. After buying and closes the position the Journal shows an instant sell which I didn’t require. Please find below the Journal display, 2023.09.01 19:55:33.012 Experts expert
Hi, I have a stop order and want to save the new ticket after the stop order is filled. I tried to use OnTradeTransaction() class but failed to do so. Here's how I do it. void OnTradeTransaction ( const MqlTradeTransaction & trans, const MqlTradeRequest & request, const MqlTradeResult &
For some reason it doesnt update my trades with the new TP. Please help. double BAvgTP (){ double ask = NormalizeDouble ( SymbolInfoDouble ( _Symbol , SYMBOL_ASK ), _Digits ); double newbtp; double loss = 0.00 ; double Lsize = 0.00 ; for ( int i= PositionsTotal ()- 1 ;i>= 0 ;i--){
  Panel update  (2)
Hello i have ((account balance )) in my EA panel,But when open position the balance it does not really move with the balance unless I make an refresh manual,How do I make it move every tick with balance in the include file please. m_lMainAcc.Create( NULL , "lMainAcc" , 0 , 20 , 40 , 1 , 1 );
Hello i am experiencing a serious problem during automatic product validation testing, the robot is based on the US30_Spot and when running it in strategy tester , real account, demo account, no errors appear at all, not even warning and everything is operating perfectly when uploading the file and
Hi, I want to ask about selecting position by ticket function. My EA is multi-currency EA and I store each buy ticket and sell ticket to BuyTicket[] and SellTicket[] Array. Usually when I want to select a position I will use loop through all open position and select each position by the ticket then
Hi, Very odd anomaly is happening. In my backtest the EA trades as programmed, one trade per day, but sometimes it places two trades in live with in one second time difference and open price is only few pipettes apart. When I backtest the exact date of the duplicate trades, then it places a single
I always look at the chart and wait for the price to hit my target to place a market order. This is because my limit orders often don't get triggered due to the spreads. Is there a script to place a limit order as if it was a market order
Hello everybody. I would like to know if there is a way to access the entire trading history through the OrdersHistoryTotal() function. If so, how can I do this via code? Thank you in advance for everyone's help and understanding
Hi guys, I am very new to this platform so please bare with me... I have recently started building an ea using mql5. I have coded it in such a way that if the previous DEAL_ENTRY_OUT returns a negative profit value, the buy/sell will not be executed until a new bar has been printed. As part of the
Hey, i have strange issue, when my tp is rising, acc equity also Then when tp is reached im closing positions (both types, BUY and SELL) And now when positions are closed, total profit is decreased as on attached pict: so i know it is tester and generally logic should be ok, but i dont want to show