| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack (2) | Thread Tools | Display Modes |
|
|||
|
Magic number
cutzpr - you need to use a magic number and then use something like the following:
for (cnt = total ; cnt >=0 ; cnt-- ) { OrderSelect(0,SELECT_BY_POS,MODES_TRADES); if (OrderMagicNumber()==yourmagicnumber) {if(OrderType()==OP_BUY) |
|
||||
|
Quote:
Code:
int totalOrders(int type)
{
int totalNumber = 0;
for (int cnt = total ; cnt >=0 ; cnt-- )
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderType() == type) totalNumber++;
}
return(totalNumber);
}
Code:
int totalBuy = totalOrders(OP_BUY);
int totalSell = totalOrders(OP_SELL);
if( (totalBuy + totalSell) < MaxOpenOrders)/*TOTAL NUMBER OF ORDERS WASN'T REACHED*/
{
if(totalBuy <= MaxLongOrders)
{
//OPENING LONG IS PERMITED
}
if(totalSell <= MaxShortOrders)
{
//OPENING SHORT IS PERMITED
}
}
__________________
You need proffesional mql coder? Contact me! I will help you! ........................................ http://www.fxservice.eu/ ........................................ |
|
|||
|
[ASK] Indicator "SilverTrend_Signal"
I'm a beginner in forex and mql4 programming. I have a indicator SilverTrend_Signal (i attach here) and
i want to make an EA from this indicator but i have a problem with this indicator, the signal can change in the same bar, such as the uptrend signal arrow appear in the chart then can disappear and maybe change to the downtrend signal arrow in the same bar. Can someone help me to solve this problem? I use this indicator in M1 time period and EU. Thankyou very much. (I'm sorry, my english is not good enough) ![]() |
|
|||
|
Quote:
If it repaints more than the current bar, so you can forget to use its signal for an EA. FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM NEW: video presentation of the Probability Meter ... 24hrs action on the website |
|
||||
|
Quote:
I also had a question about using functions inside the int start() function. Is that allowed? Isn't the vairables initialized within a function unable able to be seen by other functions? So int start() { function( int x) { // Do something return(x) } // Do Something ... "Can x be called in the start() function?' return0; } Ive attached my EA source. Your help is very much appreciated. PHP Code:
|
|
|||
|
Cheers buddy...
Quote:
Thanks cutzpr, but I managed to sort it out already... bloody internet connection was down all day and I had to use my own brain cells for once ![]() Anyway, to answer your question about the int start ()... This is your main body of the EA and is updated continuously, every tick (I think thats right). Your code is a little discombobulating... can you explain where you are experiencing an issue? I might be able to help if you can break down the problems, although I'm really just only learning MQL4 myself. |