# Orders per symbol.

Sep 11, 2013 at 12:49
1,228 zobrazení
25 Replies
Členem od Jul 16, 2013   385 příspěvků
Sep 11, 2013 at 12:49
Hi there,

I an looking for a weird EA. One that can limit orders per symbol. I have searched all over, don't seem to find one anywhere.

Členem od Jul 17, 2012   275 příspěvků
Sep 11, 2013 at 14:02
it is not a weird ea. just a logic that needs to be implemented.

to limit orders, the ea just needs to have checks for any open orders and have it not to open more than required. 😄

for per symbol is easy, you just need to add symbol checks only to the logic. 😎

the above logic also can be implemented for buy limit or sell limit too. 😎
Past experience usually helps present self
Členem od Nov 21, 2011   1718 příspěvků
Sep 11, 2013 at 14:03
Hi

If you know how to code, you simply need to count numbers of current trades (opened one) and then create a parameter that will limit to the specific number you mention.

So the EA can't open any more orders untill one of them has been closed.

Cheers
Členem od May 11, 2011   235 příspěvků
Sep 11, 2013 at 14:15
Can do something like this: (It's a rough example, not a complete EA!!!)

extern string SymbolA = 'EURUSD';
extern int OrderCountLimit = 10;

int AllOrderCount;

void OrderCount()
{

AllOrderCount = 0;

for(int i=0;i<OrdersTotal(); i++ )
{
if(OrderSelect(i, SELECT_BY_POS)==true && OrderSymbol() == SymbolA) //or Symbol() for current chart.
{

AllOrderCount++;

}
}
}

// Other code that eventually calls CheckOrderCount()

void CheckOrderCount()
{
if (AllOrderCount < OrderCountLimit)
{
OpenOrder();
}
}

void OpenOrder()
{

//Code to open / create order

}
For every loss there should be at least an equal and opposite profit.
Členem od Nov 21, 2011   1718 příspěvků
Sep 11, 2013 at 14:20
Yes... It seems you know how to count : )

If not working let me know...
Členem od Jul 17, 2012   275 příspěvků
Sep 11, 2013 at 15:34
You know, I always have this conflict either to use -- or ++

e.g. int i=0;i<OrdersTotal(); i++

during my coding time. LOL. 😂
Past experience usually helps present self
Členem od Jul 16, 2013   385 příspěvků
Sep 11, 2013 at 20:11
Thanks for your replies. I appreciate that you took the time to respond. I have no coding experience.(making this very hard) I googled this, there are quite a few codes, but no EA. All the people that had this in mind seemingly could code, made the EAs and never shared anything on the internet, I can't even get email addresses to get hold of anybody that coded such thing.

I read online (amongst the codes for this on the internet) that it would have to check the account history if there has been a trade for this symbol before placing any more. I went for asking whether there is an EA that could do this. (figured it will be much easier than getting a coder to check the EA) Will another EA be easier, or modifying the existing EA to do this?

Regards
Ryan
Členem od Jul 16, 2013   385 příspěvků
Sep 11, 2013 at 20:11
Thanks xgavinc, not being a coder makes this all seem Greek to me..
Členem od Nov 21, 2011   1718 příspěvků
Sep 11, 2013 at 20:18
I thought you knew how to code... in fact you just copy paste what you found.

I don't know what you really need so I can't give a code.

What do you need? Implement this logic into another EA?
Členem od Jul 17, 2012   275 příspěvků
Sep 11, 2013 at 23:11 (Upravené Sep 11, 2013 at 23:13)

I knew @RSTrading cant code. That is why I replied like that for the first reply. 😎

---

Getting a free EA will not do any good here @RSTrading . I already knew that type of ea and of course it needs a little bit of coding to get what you want to work. 😝

Or just get @CrazyTrader or @xgavinc to code for you for a fee. 😄
Past experience usually helps present self
Členem od Jul 16, 2013   385 příspěvků
Sep 12, 2013 at 08:33
@deysmacro , I am not looking for a free EA here, just want to know if there is such a thing so I don't have to bother coders with it.

@CrazyTrader I was purely looking for another EA because I didn't want to bother coders with modifying the existing EA, though I think it will be way easier if the actual EA is just modified. So basically then I need to implement this logic into my EA. Can you or xgavinc help please?

Členem od Jul 16, 2013   385 příspěvků
Sep 12, 2013 at 08:34
@CrazyTrader - Do I need to paste it at a specific place, or can I just paste anywhere?
Členem od Nov 21, 2011   1718 příspěvků
Sep 12, 2013 at 08:52
I count like this:

/*
*/
for(int cnt = OrdersTotal()-1; cnt >= 0; cnt--){
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == magicalNumber && (OrderType() == OP_BUY || OrderType() == OP_SELL)) {
}
}

}

// So now you owe me 50 pips : )
Členem od Jul 16, 2013   385 příspěvků
Sep 12, 2013 at 11:06

Looking back at your first post, it seems that you are under the impression that it shouldn't open more trades when there is an open trade. It can do this, the main thing I am looking for is it must only open one trade per currency pair per day. At the moment it opens up to three trades for the currency pair per day.

Thinking about it now, it should be allowed one buy and one sell for each currency pair per day. At the moment it opens three buy trades. (Sorry, just thought about this now) Does it matter where the code is pasted or can I just paste it anywhere?

Členem od Jul 17, 2012   275 příspěvků
Sep 12, 2013 at 11:12
The current code is no longer valid since it does not fulfills the requirement. So, again, @CrazyTrader have to alter the coding, and you will be owing him 100pips. 😄
Past experience usually helps present self
Členem od Nov 21, 2011   1718 příspěvků
Sep 12, 2013 at 13:09
Yes I was sure... That's why there is no point to give code like that. You can't copy paste it anywhere just like that.
Then You have to call the fucntion into your logic code to check if EA is allowed to place the trade depending on your parameter.

Also.. I said that I can't understand your logic... because you resume it in one sentence. And like me, once you start modifying codes, you better learn it because you will always have something to add.

So if you are quiet young, it's still time to learn... You need to know so basics, so at least when you have an help like that, you know how to implement it.

See, we are talking and now, we discover that you need restriction. (Only one type trade per day) which different and needs more code.

Tomorrow, what you will ask? : )

Členem od Nov 21, 2011   1718 příspěvků
Sep 12, 2013 at 13:14
See this EA, started Monday that I've been working over weeks... I'm still not happy with it so I added some new filters almost everyday.

Členem od Jul 17, 2012   275 příspěvků
Sep 12, 2013 at 13:34
Tomorrow, what you will ask? : )

Actually the first question asked from @RSTrading lacks many crucial requirements. That is why I am not seriously considering the codes since @RSTrading will ask for more.

And it happen just like what I have expected. 😎
Past experience usually helps present self
Členem od Nov 21, 2011   1718 příspěvků
Sep 12, 2013 at 13:42
So here, you have 2 examples that it is possible as I don't have neither programming background except from Excell lol.
If ('I could create EA'; Then I might make pips)

How I did... I firstly paid for my EAs from a programmer.... Then I look at his coding and learn from it. I started by changing little things... and then it comes with time if your are motivated.

Or You can buy a dedicated book on MQL4... good luck.

So you can contact me if you want.

Cheers