Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
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.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 10-11-2006, 04:10 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile One order on conditions meet..

Hi Guys,

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 10-11-2006, 11:23 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
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 (
StopLossModeStopLossLevel Ask StopLoss Point; else StopLossLevel 0.0;
         if (
TakeProfitModeTakeProfitLevel Ask TakeProfit Point; else TakeProfitLevel 0.0;
         if(
OrdersTotal() < 1)
         
Ticket OrderSend(Symbol(), OP_BUYLotsAskSlippageStopLossLevelTakeProfitLevel"Buy(#" MagicNumber ")"MagicNumber0DodgerBlue);
         if(
Ticket 0) {
            if (
OrderSelect(TicketSELECT_BY_TICKETMODE_TRADES)) {
                Print(
"BUY order opened : "OrderOpenPrice());
                if (
SignalMailSendMail("[Signal Alert]""[" Symbol() + "] " DoubleToStr(AskDigits) + " Open Buy");
            } else {
                Print(
"Error opening BUY order : "GetLastError());
            }
         }
         if (
EachTickModeTickCheck True;
         if (!
EachTickModeBarCount 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 10-11-2006, 11:26 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Quote:
Originally Posted by Eaglehawk
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 (
StopLossModeStopLossLevel Ask StopLoss Point; else StopLossLevel 0.0;
         if (
TakeProfitModeTakeProfitLevel Ask TakeProfit Point; else TakeProfitLevel 0.0;
         if(
OrdersTotal() < 1)
         
Ticket OrderSend(Symbol(), OP_BUYLotsAskSlippageStopLossLevelTakeProfitLevel"Buy(#" MagicNumber ")"MagicNumber0DodgerBlue);
         if(
Ticket 0) {
            if (
OrderSelect(TicketSELECT_BY_TICKETMODE_TRADES)) {
                Print(
"BUY order opened : "OrderOpenPrice());
                if (
SignalMailSendMail("[Signal Alert]""[" Symbol() + "] " DoubleToStr(AskDigits) + " Open Buy");
            } else {
                Print(
"Error opening BUY order : "GetLastError());
            }
         }
         if (
EachTickModeTickCheck True;
         if (!
EachTickModeBarCount Bars;
         return(
0);
      }
   } 
Many Thanks Eaglehawk....Will try this ...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 10-13-2006, 04:35 PM
Junior Member
 
Join Date: Jan 2006
Posts: 3
triumph is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 10-14-2006, 05:03 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 10-17-2006, 02:21 AM
Junior Member
 
Join Date: Jan 2006
Posts: 3
triumph is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 10-17-2006, 02:25 AM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 10-17-2006, 02:51 AM
Junior Member
 
Join Date: Jan 2006
Posts: 3
triumph is on a distinguished road
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
Attached Files
File Type: mq4 Multi_Lot_Scalper_P_D1_JLY4.mq4 (12.4 KB, 27 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #9 (permalink)  
Old 11-05-2006, 07:53 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile

Quote:
Originally Posted by triumph
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

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 11-10-2006, 01:30 AM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Unhappy

Quote:
Originally Posted by triumph
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
To trade or not to trade Indicators? yaniv_av Indicators - Metatrader 4 1 03-27-2007 02:01 PM
How to modify this order deeforex Questions 0 06-07-2006 07:03 PM
One Order per Bar....... babarmughal Expert Advisors - Metatrader 4 2 05-09-2006 10:09 AM


All times are GMT. The time now is 08:06 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.