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.
How can i amend an EA so that it trades only 1 times and once that trade is close i.e take profit is hit then dont trade again until the next opposite trade...let me explain it in detail....If the long trade has hit its TP then wait for the short trade and do not place any further trades...but at the moment my EA opens another buy trade...
Thanks
Babar
Last edited by babarmughal; 11-10-2006 at 11:16 PM.
you will notice near the top, one of the phrases is if(OrdersTotal() < 1), and the function thereafter. that is how you regulate only one trade at a time.
PHP Code:
//Buy if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { IsTrade = False;//---allows multiple orders to open if(!IsTrade) { if (StopLossMode) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0; if (TakeProfitMode) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0; if(OrdersTotal() < 1) Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue); if(Ticket > 0) { if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) { Print("BUY order opened : ", OrderOpenPrice()); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy"); } else { Print("Error opening BUY order : ", GetLastError()); } } if (EachTickMode) TickCheck = True; if (!EachTickMode) BarCount = Bars; return(0); } }
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
you will notice near the top, one of the phrases is if(OrdersTotal() < 1), and the function thereafter. that is how you regulate only one trade at a time.
PHP Code:
//Buy
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
IsTrade = False;//---allows multiple orders to open
if(!IsTrade) {
if (StopLossMode) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
if (TakeProfitMode) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;
if(OrdersTotal() < 1)
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("BUY order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
} else {
Print("Error opening BUY order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}
Hi,
By using if(OrdersTotal() < 1), only 1 trade will opened at a time. As soon as 1 trade is closed another will be opened if the conditions meet.
if we use if(OrdersTotal() < 2), then 2 trades will be opened at a time.
we need a code to open 1 long trade and hit tp, and wait for next trend to start to open a short trade.
there are several ways you could approach this problem. to determine the trend is a simple method that could be accieved by almost anything.
a moving average is one that i find the most crucial and effective. there are ways to determine the slope which i don't have the time to come up with right now, but maybe in a week.
one other way is subtacting the highs and lows or opens and closes to determine trends.
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
Thank you for your reply Eaglehawk,
I am looking for a code that would do this: Send one order per trend, if order hits takeprofit or stoploss, the order is closed.If the trend continues, it should wait for the trend to change to send another order. Thank you for your time and help.
Is it all right if you send over the ea you want the code attatched to. firstly, some ea's are setup differently than others. secondly, it helps to have the benifit of something to add on to and show than tell what to put in the code.
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
Hi,
For eg if you look at the expert i attached.... you'll notice that this ea has potential but will open trades even while the trend is fading and all those trades would result in a loss. so if we can restrict this ea to send one buy order after the price moves above the pivot and close it in profit or loss and wait until price moves below the pivot to send a sell order.
Thanks
Thank you for your reply Eaglehawk,
I am looking for a code that would do this: Send one order per trend, if order hits takeprofit or stoploss, the order is closed.If the trend continues, it should wait for the trend to change to send another order. Thank you for your time and help.
Is there anyone who can help in this matter ...please
Hi,
By using if(OrdersTotal() < 1), only 1 trade will opened at a time. As soon as 1 trade is closed another will be opened if the conditions meet.
if we use if(OrdersTotal() < 2), then 2 trades will be opened at a time.
we need a code to open 1 long trade and hit tp, and wait for next trend to start to open a short trade.
can anyone (programmers) please help us !!!!!!!!.......we are stuck
Thanks in advance
Last edited by babarmughal; 11-10-2006 at 10:15 AM.