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
  #2021 (permalink)  
Old 09-01-2009, 04:32 AM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 159
Roger09 is on a distinguished road
Quote:
Originally Posted by asgard2 View Post
Hi Everyone,
I think, that's better:
Code:
//Time Delay for the next Buy Stop Order
   if ((type == _OP_BUY) && (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0))
         
          {
         total = OrdersHistoryTotal();

            for(e = total - 1; e >= 0; e--)
               {
               OrderSelect(e, SELECT_BY_POS,MODE_HISTORY);
         
            if(OrderSymbol() != Symbol())  continue;   
               
               if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false; 
               break;
         
      }
   }
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
  #2022 (permalink)  
Old 09-01-2009, 05:05 AM
Junior Member
 
Join Date: Jun 2009
Posts: 12
asgard2 is on a distinguished road
Quote:
Originally Posted by Roger09 View Post
I think, that's better:
Hi Roger,

I am very new to coding, why do I use the "break" there? Would it automatically break when the statement is finished?

Also, any clues on how to select a deleted order from history?

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
  #2023 (permalink)  
Old 09-01-2009, 07:10 AM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 159
Roger09 is on a distinguished road
You show us just a fragment of the code and I can guess only.
I supposed you start to check the history after the last order is closed, so you need to know time when is was closed. The most fresh closed order is in the end of the history, so you don't need to know another and "break" stop checking.
It is tons of methods to find the proper order in the history, you have type, magic number, comments 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
  #2024 (permalink)  
Old 09-01-2009, 01:46 PM
Member
 
Join Date: Feb 2009
Posts: 50
happyfx is on a distinguished road
need coder for simple EA

profitable system : min 50 pips -200 pips profits per trade

1 hour system

use only 1 indicator plus ATR (20)

simple EA with tp/sl/trailing stop

EA coder can help out free please PM with your email
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
  #2025 (permalink)  
Old 09-02-2009, 12:50 AM
Junior Member
 
Join Date: Jun 2009
Posts: 12
asgard2 is on a distinguished road
2 Days and still stuck

Hi,

I am trying to add a delay after a buystop order has been deleted. I have writen the code below and although it compiles ok, it doesn't work.

Can anyone see what I am doing wrong or give me the line of code that will work for this.

thanks


Code:
   // Time Delay for the next "Buy Stop" Order after buystop is deleted.
        
        
       if  (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0)//Time Delay for the next Buy Stop Order
         
          {
         int ordersHistoryTotal = OrdersHistoryTotal();     

            for (int o=ordersHistoryTotal;o<=0;o--)           //Count down until it hits the total trades in history  
               {
              if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))   //Getting all historical trades
                  
                if ((Symbol() == OrderSymbol()) && (OrderComment() == "Buy Stop Deleted.")) continue;     
                                                                     // "Buy Stop Deleted." is the user comment 
                                                                     //added when a buystop order is deleted.
               {
              if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false; 
               break;                                                               //MayOpenDeferOrder==BuyStop Order
         }
      }
   }
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
  #2026 (permalink)  
Old 09-02-2009, 12:59 AM
Junior Member
 
Join Date: Jun 2009
Posts: 12
asgard2 is on a distinguished road
Hi,

For some reason, I cannot edit my post but the use of the "i" instead of the o in the order select statement has been changed and it still does not work

Quote:
Originally Posted by asgard2 View Post
Code:
   // Time Delay for the next "Buy Stop" Order after buystop is deleted.
        
        
       if  (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0)//Time Delay for the next Buy Stop Order
         
          {
         int ordersHistoryTotal = OrdersHistoryTotal();     

            for (int o=ordersHistoryTotal;o<=0;o--)           //Count down until it hits the total trades in history  
               {
              if(OrderSelect(o,SELECT_BY_POS,MODE_HISTORY))   //Getting all historical trades
                  
                if ((Symbol() == OrderSymbol()) && (OrderComment() == "Buy Stop Deleted.")) continue;     
                                                                     // "Buy Stop Deleted." is the user comment 
                                                                     //added when a buystop order is deleted.
               {
              if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false; 
               break;                                                               //MayOpenDeferOrder==BuyStop Order
         }
      }
   }
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
  #2027 (permalink)  
Old 09-02-2009, 01:46 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by asgard2 View Post
Hi,

For some reason, I cannot edit my post but the use of the "i" instead of the o in the order select statement has been changed and it still does not work
a) always use braces around the then-clauses (and else-clases). That might help you seeing program flow mistakes. E.g., there is a dubious "break" in the for-clause.

b) the order list is not necessarily in time order; it can be reordered via the GUI.
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
  #2028 (permalink)  
Old 09-02-2009, 04:05 PM
Junior Member
 
Join Date: Jun 2008
Posts: 10
sparow21 is on a distinguished road
Hide TP

Quote:
Originally Posted by Roger09 View Post
Replace
Code:
void OpenBuy()
{
int ticket,err;
if (!GlobalVariableCheck("InTrade")) {
GlobalVariableSet("InTrade", CurTime()); // set lock indicator
ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,1,0,Ask+TP*Poin t,"Ask-StopLoss*Point,EA Order",magic,0,Red);
GlobalVariableDel("InTrade"); // clear lock indicator
}
}

void OpenSell()
{
int ticket,err;
if (!GlobalVariableCheck("InTrade")) {
GlobalVariableSet("InTrade", CurTime()); // set lock indicator
ticket = OrderSend(Symbol(),OP_SELL,lot2,Bid,1,0,Bid-TP*Point,Bid+StopLoss*Point,"EA Order",magic,0,Red);
GlobalVariableDel("InTrade"); // clear lock indicator
}
}
to

Code:
void OpenBuy()
{
int ticket,err;
if (!GlobalVariableCheck("InTrade")) {
GlobalVariableSet("InTrade", CurTime()); // set lock indicator
ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,1,0,0,"Ask-StopLoss*Point,EA Order",magic,0,Red);
GlobalVariableDel("InTrade"); // clear lock indicator
}
}

void OpenSell()
{
int ticket,err;
if (!GlobalVariableCheck("InTrade")) {
GlobalVariableSet("InTrade", CurTime()); // set lock indicator
ticket = OrderSend(Symbol(),OP_SELL,lot2,Bid,1,0,0,"EA Order",magic,0,Red);
GlobalVariableDel("InTrade"); // clear lock indicator
}
}
Thank you very much for your kindness, Roger09.
Please accept my apology for my late response.
I will test the code and I will be back to you for the result.
=s=
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
  #2029 (permalink)  
Old 09-03-2009, 12:58 AM
Junior Member
 
Join Date: May 2008
Posts: 7
xecret is on a distinguished road
How to get the total pixels of a window?

Hi,
I need to place some lable in proportion to the total number of pixels of x-axis and y-axis of the window. But how can I get the total number of pixels?
Cheers.
xecret
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
  #2030 (permalink)  
Old 09-03-2009, 04:33 PM
Junior Member
 
Join Date: Jun 2008
Posts: 10
sparow21 is on a distinguished road
Hide TP

Roger09,

Refering to Post #2028.

The result was not as I expected.
What I meant by Hide TP is not without TP level, instead, it is invisible yet still taking profit as set in parameter.

Anyway, thank you very much for your help.

=s=
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 05:33 PM.



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