Forex



Go Back   Forex Trading > Programming > MetaTrader
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
  #2001 (permalink)  
Old 08-26-2009, 04:45 PM
Junior Member
 
Join Date: Jun 2009
Posts: 1
tonywyk2 is on a distinguished road
Need help in writing ea - Time factor to close order

if order took place, take profit=100pips & stop lost=100pips is written in the ea,

i would like to write additonal time factor(control) to close order as below:-

says the order is a buy order
-----------------------------
1) if in 1st hour, a sudden price up of 80 pips happen in 10 minutes within this hour, close order;
2) if in 2nd hour, a sudden price up of 70 pips happen in 10 minutes within this hour, close order;
3) if in 3rd hour, a sudden price up of 60 pips happen in 10 minutes within this hour, close order;
4) if in 4th hour, profit at 50 pips, close order;

5) if in 1st hour, a sudden price down of 60 pips happen in 10 minutes within this hour, close order;
6) if in 2nd hour, a sudden price down of 70 pips happen in 10 minutes within this hour, close order;
7) if in 3rd hour, a sudden price down of 80 pips happen in 10 minutes within this hour, close order;
8) if in 4th hour, loses at 50 pips, close order;

Can somebody kindly help me to write this? I am having problem in writing time factor in closing order.

Thanks

Rgds,
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
  #2002 (permalink)  
Old 08-26-2009, 05:25 PM
Member
 
Join Date: Mar 2008
Posts: 46
mauro269 is on a distinguished road
Hi Guys,
I've a question for you....do you know what's the code to put in an Expert Advisor to close all open trades at certain time?...for example I've 5 open trades and at 16 GMT the EA should close all open trades and shouldn't open new trades until the next day.
Thanks for your 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
  #2003 (permalink)  
Old 08-26-2009, 08:42 PM
Junior Member
 
Join Date: Nov 2007
Posts: 21
derumuro is on a distinguished road
Hi mauro269,

if(Hour() = 16) close Order ( GMT = 16 +/- Servertime, example 16 +1 = 17) or see http://codebase.mql4.com/3233
and
if(Hour() = 8) open new Order

Here is more info: MQL4 Documentation

Regards
derumuro

Last edited by derumuro; 08-26-2009 at 08:48 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
  #2004 (permalink)  
Old 08-27-2009, 07:37 AM
Member
 
Join Date: Apr 2006
Posts: 34
netk is on a distinguished road
On touch rather than on close

BBands_stop_v2 and ###Gann_HiLo_Activator_v2### - can someone enhance them please ?

There are few indicators that change their plot on touch - but rather most wait for the price to close past their current plot.
Exceptions are -
Parabolic SAR is one.
Bat ATR v2 is one on right setting (using CloseBase=false).

To me this means most indicators are less reliable.
The bigger the time frame the greater the risk. If you wait for a clear signal it is often at the other end of a breakout. If you take it - it is often the worst entry.

Can someone tweak BBands_stop_v2 and ###Gann_HiLo_Activator_v2### to have an extra settings like Bats_v2 does (using CloseBase=false), so they will change plot on touch, please?


The above two changes would be a good start - but the list of indicators that I think do not have this ability is huge

All_Bands_Stop
PriceChannel_Stop_v6.
All_Trendenvelopes.
TrendEnvelopes_v2.
MT4-LevelStop-Reverse-vB0-4.
#MTF_BBands_Stop_v1
ATRStops_v1.1_MTF
ATRStops_v1.1
mtfatrstops
BrainTrend1stopline
BrainTrend2Stopline
ChandelierStops V1
VolitilityPivot
VoltyChannel_Stop_v2
delta-stop
hi-lo_mod
MTF_BrainTrend1
NRTRATRStops
VoltiChannels

etc
etc.....
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
  #2005 (permalink)  
Old 08-27-2009, 09:52 AM
Junior Member
 
Join Date: Aug 2009
Posts: 1
oracle1 is on a distinguished road
Question How to improve these results?!

Hi,
I'm writing my first EA which partially shows nice numbers in back testing. However, I can't figure out how to improve the bad parts.

Firstly, it has a high winning percentage of 86% however only a small profit factor because the losing trades loose much more than the winners win!

I have a MM in place which does not use more than 5% of the account balance per trade and over all active trade not more than 11% of the account balance can be used. Also I trail all stop losses.

It seems that I'm closing (OrderClose) the winning trades too early and cut the losing trades too late (or S/L them).
What is a good strategy for that? I implemented something like "don't close winning trades even if there's a closebuy signal" but that did not work out better either!

Would appreciate any tips! The full report can be found here.

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
  #2006 (permalink)  
Old 08-28-2009, 06:48 PM
Junior Member
 
Join Date: Aug 2007
Posts: 1
horizon is on a distinguished road
easiest way to add a 3 pip TP for every manual trade?

i need to add a 3 pip take profit on the forex for every manually entered trade. what is the easiest way to do this? i have no programming skills and can not find any default value to set in metatrader 4's options.
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
  #2007 (permalink)  
Old 08-28-2009, 11:08 PM
Junior Member
 
Join Date: Jun 2009
Posts: 12
asgard2 is on a distinguished road
Reseting the buy stop order

Hi,

I have written this code and although it compiles it does not work. (Meaning it does not delete the buystop)

I was thinking there might be something wrong with the "for" statement but I am pretty new so I am not sure.

If someone could point me to the problem, I would really appreciate it.

thanks

Code:

   if( StopResetMinutes > 0) 
   {
      total = OrdersTotal();
      
      if(total>0)

       for(i=0;i<total;i++)
      {
         OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
         
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
         {
            if((TimeCurrent() - OrderOpenTime()) /60 > StopResetMinutes ) OrderDelete(OrderTicket()); 
            {
               if(PrintComments)  Print("Buy Stop Deleted."); 
                        
            }
         }
      }
   }
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
  #2008 (permalink)  
Old 08-29-2009, 12:11 AM
Member
 
Join Date: Apr 2008
Posts: 50
okfar is on a distinguished road
Quote:
Originally Posted by asgard2 View Post
Hi,

I have written this code and although it compiles it does not work. (Meaning it does not delete the buystop)

I was thinking there might be something wrong with the "for" statement but I am pretty new so I am not sure.

If someone could point me to the problem, I would really appreciate it.

thanks

Code:

   if( StopResetMinutes > 0) 
   {
      total = OrdersTotal();
      
      if(total>0)

       for(i=0;i<total;i++)
      {
         OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
         
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
         {
            if((TimeCurrent() - OrderOpenTime()) /60 > StopResetMinutes )  OrderDelete(OrderTicket());
            {
               
               if(PrintComments)  Print("Buy Stop Deleted."); 
                        
            }
         }
      }
   }
Code:
  if( StopResetMinutes > 0) 
   {
      total = OrdersTotal();
      
      if(total>0)

       for(i=0;i<total;i++)
      {
         OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
         
         if(OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol())
         {
            if((TimeCurrent() - OrderOpenTime()) /60 > StopResetMinutes ) 
            {
               OrderDelete(OrderTicket());
              if(PrintComments)  Print("Buy Stop Deleted."); 
                        
            }
         }
      }
   }
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
  #2009 (permalink)  
Old 08-29-2009, 12:19 AM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 158
Roger09 is on a distinguished road
Quote:
Originally Posted by asgard2 View Post
Hi,

I have written this code and although it compiles it does not work. (Meaning it does not delete the buystop)
If you want to close BUY or SELL orders, you have to use OrderClose() function.
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
  #2010 (permalink)  
Old 08-29-2009, 01:12 AM
Junior Member
 
Join Date: Jun 2009
Posts: 12
asgard2 is on a distinguished road
Quote:
Originally Posted by okfar View Post
Code:
  
         
         if(OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol())
         {
            if((TimeCurrent() - OrderOpenTime()) /60 > StopResetMinutes ) 
            {
               OrderDelete(OrderTicket());
              if(PrintComments)  Print("Buy Stop Deleted."); 
                        
            }
         }
      }
   }

You know, I have been working on this for two days and you solved it in a few seconds..

Thankyou Thankyou Thankyou.. Thankyou and Thankyou..

I hope I sound grateful because I am stoked!

cheers
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

Tags
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


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
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 01:35 PM.



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