Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
:: then I'm afraid it's all about the way you do your loop function... like you have to refresh it all the time a new transaction is made
IN10TION
Thanks man
Things seems little bit clear
Let me think :
Example:after first call(buy/sell) i fill array:
1,2,3
4,5,6
7,8,9
Let say new transactions appeared in history: 1',2',3' I want new array look like this :
1',2',3'
1,2,3
4,5,6
Should I count how many times procedure was call after each buy/sell When i reach required calls i update array .I'm right?
But after restarting terminal i lose this information.Should i write this to file??
Thanks again
:: you can make it complex as you want ... but the only thing that stays the same is that you have to be able to refresh/refill your array with the open orders (easily to get) &/or go into history listing (easy to get to), to refill the previous data... don't use a file if all data is already easily available in metatrader... if there is specific info/data you want to keep, then yes, but figure things out first if you really need that...
:: if you only want to add something to the array without going in a loop of everything, then yes, you have to remember the last position, to fill in the next... otherwise you will delete the previous... if you do this, then the procedure of the code will be much faster... nevertheless you need the restore procedure to.
Quote:
Originally Posted by Dakhr
Thanks man
Things seems little bit clear
Let me think :
Example:after first call(buy/sell) i fill array:
1,2,3
4,5,6
7,8,9
Let say new transactions appeared in history: 1',2',3' I want new array look like this :
1',2',3'
1,2,3
4,5,6
Should I count how many times procedure was call after each buy/sell When i reach required calls i update array .I'm right?
But after restarting terminal i lose this information.Should i write this to file??
Thanks again
Thanks man
Things seems little bit clear
Let me think :
Example:after first call(buy/sell) i fill array:
1,2,3
4,5,6
7,8,9
Let say new transactions appeared in history: 1',2',3' I want new array look like this :
1',2',3'
1,2,3
4,5,6
Should I count how many times procedure was call after each buy/sell When i reach required calls i update array .I'm right?
But after restarting terminal i lose this information.Should i write this to file??
Thanks again
Maybe I don't understand your question, but it seems to me useless to write a file with information easy to retrieve from the server (I mean the history of your trades)
What seems easy is to loop thru the history every tick (it's fast) or every new M1 bar, or when you want, and keep the count of the orders matching a specified MagicNumber. In the same loop, you store the CloseTime of each trade in the first of a two dimentional array, and for example the Ticket in the second one. Then, if your count was incremented by tree, update your static counter (+=3) and sort the array by the first dimension in descending order. From that sorted array, you can build easily the second array like you want.
Hi all, i want to ask how to write the coding that can get day, hours and minute from a file ? i know it need arrays inside our coding, but im poor in writing arrays. The concept is like Multiple10pointsX2 ea, we able to input the news time weekly into the file, then the ea will read from the file that the news time happen, so the ea will stop trading at that moment. Thanks for any help !!!
How Many Currently open Buy, and Sell Orders from EA
I just went through 134 pages hoping someone had already answer this question. But I was out of luck..
After creating and tweaking every type of cross over, and pivot point, and ATR range, and break out strategy that I can conceive with the hundreds of different indicators that I have. I realized that a full blown automated EA needs tons of variables that you need to code for. So I instead, I am starting to create user assisted expert advisors. Well to the questions at hand...
What code can be used to count how many open Buy and how many open sell orders the EA currently has open in the Market.
I do not want it to count how many open orders there are in total because I will be placing orders as well on the same account to offset the current orders that the EA has placed.
Eventually I would like to set up filters that will alter the ratio of buy and sell orders for hedging purposes.
I originally posted this as a new thread, but it was moved into another programming thread (I have no objections to its move BTW) and now seems to have got lost due to the amount of posters in that thread.
Perhaps someone here can help me?
I have nearly finished my first EA after nearly 7 days of trial and error and cutting and pasting and hours of research....
Can someone please tell me how to issue an exit or stop function to an EA?
I want the EA to delete all current and pending trades and exit after reaching 10,000 in equity. Below is that portion of the code so far:
PHP Code:
bool StopTrade; int total = OrdersTotal(), cnt = 0, ExitAtEquity=10000;
for (cnt = total ; cnt >=0 ; cnt-- ) { OrderSelect(0,SELECT_BY_POS,MODE_TRADES); if (AccountEquity ()== ExitAtEquity)//(TimeCurrent()- OrderOpenTime() >= ActiveMinutes*60 ) {if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Red); if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Red); if(OrderType()>OP_SELL) OrderDelete(OrderTicket()); StopTrade=true;} }
if (dclose==dopen && OrdersTotal() < ConcurrentTrades && StopTrade != true)
As you can see, the EA looks at the Equity and then sets the bool value of the StopTrade variable to true. The EA then acknowledges the command and does not process anything under the StopTrade != true for one cycle, but then the bool value of the StopTrade gets reset I guess and trades continue.
Firstly, is there anyway for me to get this to do what I need it to do in the manner in which I am doing it?
Secondly, is there a function that I can use to simply tell the EA to quit?
All assistance is greatly appreciated.
NB.
Quote:
cutzpr - How Many Currently open Buy, and Sell Orders from EA
I think part of my code can help you with what you need.
Well I had figured that a loop that would cycle threw all the open orders would be a start, but I wouldn't know what to tell the EA so that it will only look at the Orders placed by the EA and disregard the orders that I put in manually. Thanks.