Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


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

Reply
 
LinkBack (1) Thread Tools Display Modes
  #181 (permalink)  
Old 01-15-2007, 05:38 AM
C.E.O.'s Avatar
Member
 
Join Date: Nov 2006
Posts: 90
C.E.O. is on a distinguished road
Thanks for your effort Nicholishen. Unfortunately it didnt work. It is modifying the orders but both ways. What I mean just for clairification is in a buy situation it will move the stop up by the trail points, but it will also move it down. i need to stop the moving down.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #182 (permalink)  
Old 01-15-2007, 06:11 AM
Nicholishen's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
I understand what you mean, but the code is correct. There is either another EA modifying these orders or there is other code in the EA that is doing it becuase it is certainly not this code. You will need to stop all other EA's and check the primary EA code for other calls to OrderModify()

Good luck =)
Attached Files
File Type: mq4 Trailing TEST.mq4 (2.8 KB, 22 views)
__________________
"Anyone who has never made a mistake has never tried anything new." -Albert Einstein

Last edited by Nicholishen; 01-15-2007 at 06:13 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #183 (permalink)  
Old 01-15-2007, 07:04 AM
C.E.O.'s Avatar
Member
 
Join Date: Nov 2006
Posts: 90
C.E.O. is on a distinguished road
Thanks for your time with my noobish self
the only other ordermodify in the code is a break even and lock pips. i will attach it.

BEx=amount of pips to lock in

I have been thru it so many times im sure it is looking right at me, but I am no pro, a hack at best.

Thanks again Nicholishen!

PHP Code:
void DoBE(int byPips)
  {
    for (
int i 0OrdersTotal(); i++) {
     
OrderSelect(iSELECT_BY_POSMODE_TRADES);
     if ( 
OrderSymbol()==Symbol() && ( (OrderMagicNumber() == uniqueGridMagic) || (OrderComment() == GridName)) )  // only look if mygrid and symbol...
        
{
            if (
OrderType() == OP_BUY) if (Bid OrderOpenPrice() > byPips MarketInfo(OrderSymbol(), MODE_POINT)) if (OrderStopLoss() != (OrderOpenPrice() +  MarketInfo(OrderSymbol(), MODE_POINT))) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() +  MarketInfo(OrderSymbol(), MODE_POINT)*BExOrderTakeProfit(), Red);
            if (
OrderType() == OP_SELL) if (OrderOpenPrice() - Ask byPips MarketInfo(OrderSymbol(), MODE_POINT)) if (OrderStopLoss() != (OrderOpenPrice() -  MarketInfo(OrderSymbol(), MODE_POINT))) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() -  MarketInfo(OrderSymbol(), MODE_POINT)*BExOrderTakeProfit(), Red);
        }
    }
  } 
Oh forgot to add, this is the only EA. Just currently backtesting.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #184 (permalink)  
Old 01-15-2007, 07:19 AM
Nicholishen's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
Quote:
Originally Posted by C.E.O.
Thanks for your time with my noobish self
the only other ordermodify in the code is a break even and lock pips. i will attach it.

BEx=amount of pips to lock in

I have been thru it so many times im sure it is looking right at me, but I am no pro, a hack at best.

Thanks again Nicholishen!

PHP Code:
void DoBE(int byPips)
  {
    for (
int i 0OrdersTotal(); i++) {
     
OrderSelect(iSELECT_BY_POSMODE_TRADES);
     if ( 
OrderSymbol()==Symbol() && ( (OrderMagicNumber() == uniqueGridMagic) || (OrderComment() == GridName)) )  // only look if mygrid and symbol...
        
{
            if (
OrderType() == OP_BUY) if (Bid OrderOpenPrice() > byPips MarketInfo(OrderSymbol(), MODE_POINT)) if (OrderStopLoss() != (OrderOpenPrice() +  MarketInfo(OrderSymbol(), MODE_POINT))) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() +  MarketInfo(OrderSymbol(), MODE_POINT)*BExOrderTakeProfit(), Red);
            if (
OrderType() == OP_SELL) if (OrderOpenPrice() - Ask byPips MarketInfo(OrderSymbol(), MODE_POINT)) if (OrderStopLoss() != (OrderOpenPrice() -  MarketInfo(OrderSymbol(), MODE_POINT))) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() -  MarketInfo(OrderSymbol(), MODE_POINT)*BExOrderTakeProfit(), Red);
        }
    }
  } 
Oh forgot to add, this is the only EA. Just currently backtesting.
Probably what is happen is that one fuction is nullifying the other. You will need to check your logic so that only one operates at a time.
PHP Code:
void DoBE(int byPips

   for (
int i 0OrdersTotal(); i++) 
   { 
      
OrderSelect(iSELECT_BY_POSMODE_TRADES); 
      if ( 
OrderSymbol()==Symbol() && ( (OrderMagicNumber() == uniqueGridMagic) || (OrderComment() == GridName)) )  // only look if mygrid and symbol... 
      

         if (
OrderType() == OP_BUY)
         {
            if (
Bid OrderOpenPrice() > byPips MarketInfo(OrderSymbol(), MODE_POINT)) 
            {
               if (
OrderStopLoss() != (OrderOpenPrice() +  MarketInfo(OrderSymbol(), MODE_POINT)))
               {
                  
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() +  MarketInfo(OrderSymbol(), MODE_POINT)*BExOrderTakeProfit(), Red); 
               }
            }
         }
         if (
OrderType() == OP_SELL)
         {
            if (
OrderOpenPrice() - Ask byPips MarketInfo(OrderSymbol(), MODE_POINT)) 
            {
               if (
OrderStopLoss() != (OrderOpenPrice() -  MarketInfo(OrderSymbol(), MODE_POINT)))
               {
                  
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() -  MarketInfo(OrderSymbol(), MODE_POINT)*BExOrderTakeProfit(), Red); 
               } 
            } 
         }
      }
   }
   return;

__________________
"Anyone who has never made a mistake has never tried anything new." -Albert Einstein
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #185 (permalink)  
Old 01-27-2007, 05:01 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,174
matrixebiz is on a distinguished road
Code for 'Allow live trading'

Hello, for EA's to work we have to enable the 'Allow live trading' option so in stead of having to tick it all the time when loading the EA what line of code do I add to automatically have that option enabled in the EA?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #186 (permalink)  
Old 01-27-2007, 05:39 PM
RJ1's Avatar
RJ1 RJ1 is offline
Member
 
Join Date: Jan 2006
Location: Kuala Lumpur, Malaysia
Posts: 45
RJ1 is on a distinguished road
You dont need code to do that..

Quote:
Originally Posted by matrixebiz
Hello, for EA's to work we have to enable the 'Allow live trading' option so in stead of having to tick it all the time when loading the EA what line of code do I add to automatically have that option enabled in the EA?

Thanks
Hallo Matrixebiz,

You can do that easily by going to MetaTrader's menu. Go to "Tools" then "Options" (or just type CRTL-O). Then, in the "Expert Advisor" tab, check the Allow live trading options. There you go, all the EA you attach after that will be allowed live trading.

-RJ1-
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #187 (permalink)  
Old 01-28-2007, 02:26 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,174
matrixebiz is on a distinguished road
Oh, ok, that was easy Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #188 (permalink)  
Old 01-31-2007, 05:07 PM
Senior Member
 
Join Date: Jan 2006
Posts: 80
jyrik is on a distinguished road
EA time code

I want EA time code. Example that it would enable only trading 18:00-1:00. Is it possible?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #189 (permalink)  
Old 01-31-2007, 05:19 PM
Senior Member
 
Join Date: Jan 2006
Posts: 80
jyrik is on a distinguished road
Found this
if (UseHourTrade){
if(!(Hour()>=FromHourTrade&&Hour()<=ToHourTrade)){
Comment("Non-Trading Hours!");
return(0);
One question:
It uses my forex broker time : Yes or No??
I think yes but I want to be sure
And how can I put there minutes there like 15:30 ?? There is only hours??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #190 (permalink)  
Old 01-31-2007, 05:25 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,817
Blog Entries: 145
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Ask!

Ask!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 07:24 AM

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 12:03 PM.



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