Need coding to close out positions created by EA on Friday just before close of week!
1) Can anyone help to provide the ea coding to close out all positions just before the market closes on Friday.
2) Also, coding needed to put each ea to sleep at the same time on Friday PM (So it does not open up any new positions) until Sunday PM when it will allow the ea to trade again.
Many thanks to your generosity in advance!
Error 65 & 128 explanation
Hi, I was hoping someone could help me and explain a couple of errors I received while testing an EA I am writing.
I ran the EA through the night to see if it was working properly and when I woke there were a couple of errors that I can't find an explanation for.
Error(65) : Invalid Account
Error(128) : Trade Timeout
Error(129) : Invalid Price
I've never run into these errors before. Does this mean that I was trading on OFF market hours?
Please help, thanks
Never Mind. Didn't realize that the demo account was for only 30days, and just so happens last night was the 30 day mark.
Opend Order - Splitting
gives a way or code for closing smaller Lots - from opend position?
example: open 1 - close 0.5 ... or close 0.3 - from this position?
subtracting the counted_bars from the total count of the bars on chart.
Does anybody know what this means? I need help with it.:)
Take a look to the mql4 help file:
The function returns the amount of bars not changed after the indicator had been launched last. The most calculated bars do not need any recalculation. In most cases, same count of index values do not need for recalculation. The function is used to optimize calculating.
I think it is the number of the bars which was not changed after the last indicator's call.
For example we had 300 bars. Then EA may call indicator for the signal or to open the order. For example: H1 timeframe. So we still have 300 unchanged bars. Because 301th bar is open bar and this bar will not be counted.
Because many indicators and EAs are calculated using i bars so using this function we may be sure that this i number of bars was unchanged and indicator will not re-paint and everything will be on close bar.
It is example in help file:
for(int i=0; i<limit; i++)
But, sorry, I am not a coder so may be wrong.
Thank You guys, I have one more question please:
I spent many hours, and I cannot solve the problem to this code:
I want the USD\JPY to trigger a buy at this point. What's wrong with this code?
Can somebody tell me a code syntax that will trigger a buy at a certain time?
Thank You. God bless You.
Also, can someone tell me a code syntax that will trigger a buy at a certain time?
MODE_ASK?? who told you that the constant MODE_ASK means more than the number 10.
Well, MODE_ASK is used with the function MarketInfo to get the ask price of a currency not the one hosting the EA.
double ask =MarketInfo("EURUSD",MODE_ASK);
so, your code should be:
if(ask == 121.10)
//do whatever you want.
And about setting time to buy you can use:
[PHP]if (TimeHour(TimeCurrent()) == 12 && TimeMinute(TimeCurrent()) >= 30)
//place a buy order
The code above place an order at 12:30 PM
Please enable the necessary setting in your browser, otherwise you will not be able to log in.