Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 973

 
I'm asking for your help. After the latest build updates multitemporal indicators are not working anymore. If I try to put MTF indicator with timeframe different from the chart timeframe, the terminal crashes. What do you recommend?
 

Question to programmers.

I have an EA which sets a stop loss and take profit at a specified number of points when opening an order. We have to make it in the following way,

to open a pending order of the same size instead of a stop loss.

I changed the following line

if (!OrderModify(OrderTicket(),OOP,SL,TP,0,White)) Print("Error OrderModify ",GetLastError());

to

OrderSend(Symbol(),OP_BUYSTOP,1*Lots,Ask+Stoploss*Point,3,0,0,0) ; //Put a Buy Pending

The order is placed, but not one, as it should be; it hits a new one every second, until the EA is disabled. What do I need to adjust?

I want to place one pending order on one open order?

I would appreciate any constructive feedback.

Thank you.

 
Alligator:

Question to programmers.

I have an EA which sets a stop loss and take profit for a specified number of points when opening an order. We have to make it in the following way,

Instead of a stop loss, a pending order of the same size will open.

...

Instead of the stop order, the order is placed, but not one, as it should be, but every second a new one is placed, until the EA is switched off. What do I need to change?

to put one pending order on one open order?

I would appreciate any constructive feedback.

Thank you.

One option is to use magic numbers. Give the new order its own unique number and then check if there is a pending one with that number, then don't place anything.
 

The problem mentioned above has been solved. Thank you.

 

me again, I haven't changed the code, all the code was above.


void Fr_sign()

{

double gdClose_array[1];

if(CopyClose(_Symbol,PERIOD_CURRENT,1,1,gdClose_array)!=1) return;

Print("Close price = ",DoubleToStr(gdClose_array[0],_Digits));

}

Result of run on 5 min timeframe from Monday to Friday

2015.01.12 00:00 111 EURUSD,M5: Close price = 1.05708

2015.01.12 14:30 111 EURUSD,M5: Close price = 1.05708

2015.01.13 03:49 111 EURUSD,M5: Close price = 1.05708

2015.01.13 20:30 111 EURUSD,M5: Close price = 1.05708

2015.01.14 10:20 111 EURUSD,M5: Close price = 1.05708

2015.01.15 11:00 111 EURUSD,M5: Close price = 1.05708

2015.01.15 23:59 111 EURUSD,M5: Close price = 1.05708

The value does not change during the whole testing period

 

did a code run on a second laptop, result:

2015.01.12 00:00 111 EURUSD,M5: Close price = 1.18402

2015.01.12 05:28 111 EURUSD,M5: Close price = 1.18558

2015.01.12 05:30 111 EURUSD,M5: Close price = 1.18605

2015.01.12 18:46 111 EURUSD,M5: Close price = 1.18276

2015.01.13 18:00 111 EURUSD,M5: Close price = 1.17806

2015.01.13 19:02 111 EURUSD,M5: Close price = 1.17778

i.e. normal result

Reinstalled the software, seems to have solved the problem,

Paladin80 thanks for your participation.

 

I threw an EA on a Mt4 chart.

I have made changes in mqlEditor. I pressed the compile button. The EA should restart on a chart. But it will not.

I have to reset the EA on the chart in order to restart it.

What is the problem?

 
serler2:

I threw an EA on a Mt4 chart.

I have made changes in mqlEditor. I pressed the compile button. The EA should (it should not!) restart on a chart. But it hasn't.

I have to reset the EA on the chart for it to be restarted.

What is the problem?

The Expert Advisor that is already running on the chart is not changed after the code has been changed.
 
paladin80:
After changing the code, the EA already running on the chart is not replaced by itself.

After changing the code, I compile the EA. Previously, after recompiling, the EA on the chart was updated.

 
Good day to you all! I'm really looking forward to your help. I think the solution to my question will be of interest to many people. When the market is very active, the Expert Advisor often sets wrong levels of stop and take. Is it possible to write code that would force the EA to check if the close levels of a position are set correctly after it is opened, and if they are different from those originally set, then the EA will set the stop and take levels correctly. For example, I want a trade to be opened with equal stop and take levels of 50 units, which has been set in the EA. But because of the strong oscillations a trade opens with stop loss at 47 and take profit at 53 which does not suit me. Please help me to write a code that will make the close levels equal to 50 after the deal is opened. I would be very grateful and I am sure I am not the only one.