New metatrader 4 compatible experts - page 16

 
engelmann:
When distanceToUse is active only the first opened StopOrder is modified with StopLoss, the second StopOrder is not modified with SL. _multi-news-1.02.mq4

Whioops Try it it now : _multi-news-1.03.mq4

Files:
 
mladen:
Whioops Try it it now : _multi-news-1.03.mq4

still not working. its when distanceToUse is active, the second StopOrder is not modified with SL.

_multi-news-1.03.mq4

Files:
 
engelmann:
still not working. its when distanceToUse is active, the second StopOrder is not modified with SL. _multi-news-1.03.mq4

engelmann

That is the same picture you sent before

Are you testing the 1.03 version?

______________________

PS: I did not change anything in the conditions. All I changed is how the opening price is calculated if you specify the distance from bid and ask .

 

Found one possible problem. That is corrected (since that one is a multi symbol EA, that is corrected) : _multi-news-1.04.mq4

_______________________

PS: this is the part where I made changes :

if (!stop_orders_buy&&!orders_buy&&!orders_sell)

{

RefreshRates ();

int digits = MarketInfo(instrument [n], MODE_DIGITS);

if (distanceToUse>0)

price = NormalizeDouble((MarketInfo (instrument [n], MODE_ASK)+distanceToUse*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2)),digits);

else price = NormalizeDouble((MarketInfo (instrument [n], MODE_ASK)+MarketInfo (instrument [n], MODE_STOPLEVEL)*MarketInfo (instrument [n], MODE_POINT)*2),digits);

int ticket = OrderSend (instrument [n], OP_BUYSTOP, Lots*vazhnost , price,40,0,0,0,i,0,Blue);

if (ticket!=-1 && stopLossPips!=0)

dummyResult = OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()-stopLossPips*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2),0,0);

}

if (!stop_orders_sell&&!orders_buy&&!orders_sell)

{

RefreshRates ();

digits = MarketInfo(instrument [n], MODE_DIGITS);

if (distanceToUse>0)

price = NormalizeDouble((MarketInfo (instrument [n], MODE_BID)-distanceToUse*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2)),digits);

else price = NormalizeDouble((MarketInfo (instrument [n], MODE_BID)-MarketInfo (instrument [n], MODE_STOPLEVEL)*MarketInfo (instrument [n], MODE_POINT)*2),digits);

ticket = OrderSend (instrument [n], OP_SELLSTOP, Lots*vazhnost , price,40,0,0,0,i,0,Red);

if (ticket!=-1 && stopLossPips!=0)

dummyResult = OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()+stopLossPips*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2),0,0);

}

(lines 357 to 379) the rest is exactly the same as the original and does not depend on the changes made in the upper part of the code, so the upper part of the code can not change how the rest of the code works

Files:
 
mladen:
engelmannThat is the same picture you sent beforeAre you testing the 1.03 version?______________________PS: I did not change anything in the conditions. All I changed is how the opening price is calculated if you specify the distance from bid and ask .

Yes is test it with 1.03

Files:
capture_4.jpg  21 kb
capture1.jpg  142 kb
 
mladen:
Found one possible problem. That is corrected (since that one is a multi symbol EA, that is corrected) : _multi-news-1.04.mq4_______________________PS: this is the part where I made changes :
if (!stop_orders_buy&&!orders_buy&&!orders_sell) { RefreshRates (); int digits = MarketInfo(instrument [n], MODE_DIGITS); if (distanceToUse>0) price = NormalizeDouble((MarketInfo (instrument [n], MODE_ASK)+distanceToUse*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2)),digits); else price = NormalizeDouble((MarketInfo (instrument [n], MODE_ASK)+MarketInfo (instrument [n], MODE_STOPLEVEL)*MarketInfo (instrument [n], MODE_POINT)*2),digits); int ticket = OrderSend (instrument [n], OP_BUYSTOP, Lots*vazhnost , price,40,0,0,0,i,0,Blue); if (ticket!=-1 && stopLossPips!=0) dummyResult = OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()-stopLossPips*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2),0,0); } if (!stop_orders_sell&&!orders_buy&&!orders_sell) { RefreshRates (); digits = MarketInfo(instrument [n], MODE_DIGITS); if (distanceToUse>0) price = NormalizeDouble((MarketInfo (instrument [n], MODE_BID)-distanceToUse*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2)),digits); else price = NormalizeDouble((MarketInfo (instrument [n], MODE_BID)-MarketInfo (instrument [n], MODE_STOPLEVEL)*MarketInfo (instrument [n], MODE_POINT)*2),digits); ticket = OrderSend (instrument [n], OP_SELLSTOP, Lots*vazhnost , price,40,0,0,0,i,0,Red); if (ticket!=-1 && stopLossPips!=0) dummyResult = OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()+stopLossPips*MarketInfo (instrument [n], MODE_POINT)*MathPow(10,digits%2),0,0); }
(lines 357 to 379) the rest is exactly the same as the original and does not depend on the changes made in the upper part of the code, so the upper part of the code can not change how the rest of the code works

Then is it possible to change the "stop level distance to the price" value in the code?

 
mladen:
engelmannThe way it was made by the author, it opens the pending orders at the 2 x stop level distance from the current price. Anyway add one more parameter : distanceToUse. If it is > 0, then it is used and not stop level distance. If it is set to

Attach you set file that you are using for testing

The original is not opening any orders in my back test - so please, attach your set file and specify what broker, symbol and time frame you are using for testing with the version that you are testing (last version I posted is 1.04)

 
engelmann:

Attach you set file that you are using for testing

The original is not opening any orders in my back test - so please, attach your set file and specify what broker, symbol and time frame you are using for testing with the version that you are testing (last version I posted is 1.04)

distanToUse works at value 0.01 on EURUSD

Im using IC Markets Demo, EURUSD, M1, 10000, from 1.3.2015 - 7.04.2015. set-file is attached.

Is it possible to change the "stop level distance from the current price" value in the code, you mentioned in post #150?Then distantToUse would not be not neccassery.

usd_events.set

Files:
 
mladen:

distanToUse works at value 0.01 on EURUSD

Im using IC Markets Demo, EURUSD, M1, 10000, from 1.3.2015 - 7.04.2015. set-file is attached.

Is it possible to change the "stop level distance from the current price" value in the code, you mentioned in post #150?Then distantToUse would not be not neccassery.

usd_events.set

A version that worked without a single error and the set file I used :

new_test.set

_multi-news-1.05.mq4

You will have to experiment a bit with the distances and the stop losses. If you get an error 130, that means that the pending order opening price or stop loss is too close to the current price (and in that case you have to make either of those larger)

Happy testing

Files:
 
engelmann:
A version that worked without a single error and the set file I used :

new_test.set

_multi-news-1.05.mq4

You will have to experiment a bit with the distances and the stop losses. If you get an error 130, that means that the pending order opening price or stop loss is too close to the current price (and in that case you have to make either of those larger)

Happy testing

Its almost perfect When an Order hits SL then it reopens a new order of the same type. Could you make a last version in which to restrict the number of reopened orders to zero or an option to define a limit number of reopened orders (number of tries). Set-File is attached using same parameters of post #159.

usd_events1.set

Files:
capture_5.jpg  242 kb
Reason: