Reply

Error: broker stop difference: 0.00

3 replies

odomike

Subscriber, bbp_participant, community, 32 replies.

Visit profile

10 years ago #112087

I am trying to create an EA that trades news events. It is meant to open  a number of pending stop orders in both directions just before the news event and then, manage the orders till closure. I have tried to setup the rules such that the EA places the orders at particular (User configurable) gaps from the ASK and BID prices.

 

This is what I did:

 

IF

 

                     (((            DateCurrent = GetDate(Day, Month, Year)

and                               TimeCurrent >= GetTime(Hour, Minute, Second)

and                               EnableMoneyManagement = True                                     )))

 

THEN

 

Enter At Stop:

         Symbol: Current

         Direction: Long

         Price: Ask + (GapFromPrice x 0.01)

         Quantity: PreDefined MM

         …………………………………

 

Enter At Stop:

         Symbol: Current

         Direction: Short

         Price: Bid + (GapFromPrice x -0.01)

         Quantity: PreDefined MM

         ………………………………….

 

Notice that the Short order has the multiple set to -0.01 and Long at 0.01. I dont know if I got this right but, this is meant to add and subtract that number of pips from the ASK/BID prices respectively and give the required amount of gap from the ASK/BID prices. The GapFromPrice (12) in there is the GAP from the ASK/BID prices to the pending stop order prices. I got the 0.01 when I was creating another EA and used a multiple of 1 and it gave me a gap of 500 pips instead of the required 5 pips, so 0.01 it is to give a gap of 100/1. I hope I am making some sense in my explanations.

 

The main problem I am facing is that EA, once initialized by MT4, gives an error:

 

TimeCurrentDateCurrent EA GBPJPY,M15: —VERBOSE— 2014.04.18 23:39 Broker Stop Difference: 0.00

 

And does absolutely nothing. I neither know nor understand the meaning of the error and its quite annoying.

 

Please help me to figure out what this problem is and how to solve it. I have attached both the strategy file and source code for your reference.

 

Thanks for your time and support.

 

Best regards,

Michael.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

10 years ago #124233

Hello,

 

I checked your strategy and made few corrections.

 

1. renamed Day, Month, Year etc. to myDay, myMonth, myYear… They are reserved works in MQL, so it could cause problems to name variables like that.

 

2. changed your price formula, you should use function ConvertToRealPips() when you want to convert value in pips to price

 

In my test it opened order correctly. If it doesn’t work for you try to remove the day or time condition if there isn’t problem with that.

Mark
StrategyQuant architect

0

odomike

Subscriber, bbp_participant, community, 32 replies.

Visit profile

10 years ago #124273

OK Mark, but I dont know how to use the ConvertToRealPips function to create the price formula. Can you help me out?

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

10 years ago #124360

sorry, I forgot to attach the corrected strategy. You can see how it is made there.

Mark
StrategyQuant architect

0

Viewing 3 replies - 1 through 3 (of 3 total)