Questions tagged [expert-advisor]

22 questions
3
votes
3 answers

How to code and compile mql4 and mql5 language in VS Code?

I moved to mql4 and mql5 programming language. But, MetaEditor is very noob to code with, so I want to code mql4 language and compile with VS Code. If you have any solution please share with us..... Thanks
1
vote
0 answers

Invalid Request 10013 trying to close order. Metatrader 5

I can successfully place order and retrieve the ticket id by result.order, but when i try to close the order always get invalid request 10013 using metatrading 5. Tried to close the order 2 ways. With the below function CloseTradeOrder AND using…
StackNet
  • 13
  • 3
1
vote
0 answers

ValueError: Long orders require: SL < LIMIT < TP

[this error msg when i run my code ](https://i.stack.imgur.com/2dkL9.jpg) I am writing code for a bot in python but when i run it i got the ValueError msg. This is limiting me to increase take profit which I don't need. I want to put a lesser value…
1
vote
0 answers

efficiency in 2 different scenario of code structure on mql4 Expert Advisor

Hi I have EA with code structure like this, void OnTick() { resetCounterVar(); //there's for loop CloseOrders(); //there's for loop UpdateAllOpenOrders(); //there's for loop SetSLTP(); //there's for loop CheckPendOrder();…
1
vote
1 answer

MT5 || python: closing pending order after x minutes

I am using python connected to MT5, and have manage to load pending order with sl, tp, etc. I am now having problem expiring the pending order after 30 min, maybe, how do I put it in the request section? I have tried mt5.ORDER_TIME_SPECIFIED_DAY but…
1
vote
1 answer

why pending orders doesn't adjusted in mql4? error: the price doesnt declared. here is the mql4 code

/here i saved my last order's open price at op parameter./ double op = OrderOpenPrice(); int ticket = SendOrder(_symbol,OP_SELLSTOP,0.02,op -0.0020,100, 0,0);
ali
  • 35
  • 3
0
votes
0 answers

I had trouble setting the ATR value as the stoploss in mql4

When I take a test, error messages occur for the stoploss and the take profit, and the trade is not opened. Please look at the code, where I am doing wrong? input double atrXsl = 1.5; input double atrXtp = 1.5; void sell() { double atr =…
Salvator3e
  • 31
  • 5
0
votes
1 answer

mql5 error when drawing rectangle at specific candle location

I am trying to draw a rectangle starting at the gap when theres an FVG and have one of my curly brackets in the wrong place as its telling me i cant have my if statements in the global scope. i need to be able to draw a rectangle when there is a gap…
pebs
  • 11
  • 4
0
votes
0 answers

How do I fix this code so that the EA can recognize whether price is above or below the 200 EMA?

I coded this EA based on the Squeeze Momentum Strategy. Its only supposed to take buy trades when the price is above the 200 EMA and the Bollinger Bands are outside the Keltner Channel and vice versa for sell trades but the EA still takes buy trades…
0
votes
0 answers

MT5 Position Netting changing SLO/TP to the last trade Python 3

I have Mt5 Netting Demo account and I am using MT5 api to test my strategy on demo account when any trade open it get merged in the same group and because of that I face the following problems: Stoploss and Take profit get revised not on average…
0
votes
0 answers

How to avoid looping while calculating order position size in MQL5?

In short, I'm writing an Expert Advisor to execute trades on the MT5 platform. The logic is fine, but I'm struggling with the position size (lot size). Here is the idea: I open a market buy order at the Current Close Price (Close[0]) Stop loss…
0
votes
1 answer

I want to open a position in mql4 in an specific period of time

I have created an Expert that works with an indicator, every time the indicator gives us an buy or sell signal my expert opens a position but I want to change it in a way that the expert only opens a position when it is in the specific period of…
arvin sh
  • 9
  • 2
0
votes
0 answers

BigQuery cyclic increment/variable handling

I am doing a migration from an existing Informatica Powercenter code to BigQuery where I ran into a scenario where a value of a column is being derived from another derived column in the same Informatica expression Informatica Scenario: v_abc =…
0
votes
0 answers

MQL4 ExpertAdvisor OrderSend sometimes opens terminal Order Screen

In my expert advisor that I've written, sometimes my call to OrderSend Opens a window, The one you get in mt4 terminal mode when you right click on a ticket and select modify or delete. I have to manually select to send or cancel the order. It does…
0
votes
0 answers

my position not open in mql5 expert adviser?

Hi I try create Expert Adviser in mql5. I want after open position save the ticket of that position on some arrays and then close the position with that tickets,But the trade is not open. how can i fix this? please help. this is my open trade…
sadegh
  • 103
  • 5
1
2