Help Needed - MarketInfo() && point=0; => error 130

 

Hello Guys,

Does anyone know why am I taking point=0 as result of MarketInfo function ??


double point = MarketInfo(Symbol(),MODE_POINT);
double min_distance=MarketInfo(Symbol(),MODE_STOPLEVEL);


I print the results in terminal and I see point = 0 and min_distance = 40. Is this normal?

I tried without MarketInfo function too and the result was the same: point = 0 !!!


The thing is that all my calculations go wrong and it's return error 130...but this is normal as I have invalid stops



ticket = OrderSend(Symbol(),OP_BUYSTOP,Lots,(ask+(c*Point)),0,bid-(StopLoss*point),(ask+((c+TakeProfit)*Point)), NULL,0,0,Green);


Can you please help me?
I am waiting for your replies
Thank you
Mary

 

Print truncates to 4 decimal places...(presumably, you're on a 5 digit broker)... try DoubleToStr()https://docs.mql4.com/convert/DoubleToStr

Stoplevel will need multiplying by Point.

hth

V

Edit: Print won't affect the value the EA sees... the EA will use the correct value of 0.00001 so you may have some tracking down to do if you are getting 130.

 
ticket = OrderSend(Symbol(), OP_BUYSTOP, Lots, (ask+(c*Point)), 0, bid-(StopLoss*point),
 (ask+((c+TakeProfit)*Point)), NULL,0,0,Green);
On ECN brokers you can't set the SL/TP with the original OP_BUY. I found the same with limits and stops.
 
WHRoeder:

On ECN brokers you can't set the SL/TP with the original OP_BUY. I found the same with limits and stops.

Excuse me I don't understand. Can you please explain more..If it 's not a problem can you show me where is the error in OrderSend() ?

Thank you
 

send the order with SL/TP == 0

Once the order fills, then set the SL/TP

 
Thank you guys problem solved!!
 

Hi guys,

could someone fix this mistake for me by doing a favor?

I am learning and I cannot correct it.

Moderators note:

Code has been deleted. Please use the code button (Alt + S) when pasting code.

Remove all links from the code.

 
  1. Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.

  2. Don't resurrect old threads without a very good reason. A lot has changed since Build 600 and Higher. 2014.02.03, such as (#4) there is no need to open an order and then set the stops. Simplify your code - do it in one step. TP/SL on OrderSend has been fine for years.
              Build 500 № 9 2013.05.09

  3. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  4. and state the nature of your problem.
Reason: