Help: How to write simple EA to buy and sell at a specific time? - page 2

 

I am sorry, I do not know which line to delete.

Even I set the profit target > 10, and when the time comes, the robot can't open any positions.

Anything wrong?

 

New version

jack2:
I am sorry, I do not know which line to delete.

Even I set the profit target > 10, and when the time comes, the robot can't open any positions.

Anything wrong?

I commented out the lines that check for TakeProfit.

It does check for the exact time to the minute so if there is no tick for the minute entered it will not place the trade.

Time must be entered as an integer.

For example 13:30 would be entered as 1330.

If there is no tick until 1331 the trade will not be entered.

I would be useful to have a time range begin and end for the trade to be placed so I added that as well. The default is a two minute window for trade to be entered.

Robert

Files:
 
MrPip:
I commented out the lines that check for TakeProfit.

It does check for the exact time to the minute so if there is no tick for the minute entered it will not place the trade.

Time must be entered as an integer.

For example 13:30 would be entered as 1330.

If there is no tick until 1331 the trade will not be entered.

I would be useful to have a time range begin and end for the trade to be placed so I added that as well. The default is a two minute window for trade to be entered.

Robert

I downloaded the latest EA here and the time format is correct but there were no trades opened also.

MrPips, mind to look into it?

 

This one will do what I think your looking for.

Hope this helps.

gbp9am.mq4

Files:
gbp9am.mq4  8 kb
 
proverbs:
This one will do what I think your looking for.

Hope this helps.

gbp9am.mq4

Thanks. It helps.

However, if I change the setting as follows (not using the default)

2007.06.14 15:30:35 GBP9AM EURUSD,M1 inputs: look_price_hour=7; look_price_min=31; close_hour=17; use_close_hour=true; take_profit=5; open_long=0; open_short=0; stop_long=0; stop_short=0; slippage=0; lots=0.1; magic=20051016;

None of the trades were opened. Why?

 

I noted that this EA could not open at current market price. It must be on Stop.

Then if one of the trade executed, the other side will be closed.

Can it be modified not to close and to maintain there?

I need to open 3 Buy positions and 3 Sell positions at the same time at market price.

 

If you want to open a trade at specific time, you either have to have the EA put in a market order or your pending order must be the a minimum number of PIPs away from the current price as dictated by your broker. You may want to look at one of those news EA.

 
et_phonehome_2:
If you want to open a trade at specific time, you either have to have the EA put in a market order or your pending order must be the a minimum number of PIPs away from the current price as dictated by your broker. You may want to look at one of those news EA.

If the order should base on the market price at the time specified and must be executed. Thus, there is no number of pips away from the price.

The minimum exit target as required by broker is 5.

 

Can someone please create a version that will specify a long and short entry price ("1.1234", "1.4321") instead of a trigger?

I basically want to place 2 specific pending orders at a specific start time with an expiration, based on the "Daily 20 Pips" strategy.

Thanks for any help.

 

buy and sell EA or Indicator

I was wondering if any of you forex gurus could lead me in the right path of getting a EA that would execute a buy and sell at the same time? Thanks in advance!

Very Respectfully,

killakx3