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 Thread Tools Display Modes
  #1071 (permalink)  
Old 07-06-2008, 04:59 PM
Administrator
 
Join Date: Sep 2005
Posts: 15,986
Blog Entries: 70
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
Look at this thread How to LOCK/Encrypt EA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1072 (permalink)  
Old 07-06-2008, 05:07 PM
onetarmizi's Avatar
Senior Member
 
Join Date: Apr 2007
Posts: 144
onetarmizi is on a distinguished road
Quote:
Originally Posted by newdigital View Post
Look at this thread How to LOCK/Encrypt EA
Thanks for that link. Finally I was found the page that I'm looking for here
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1073 (permalink)  
Old 07-06-2008, 09:09 PM
Senior Member
 
Join Date: Oct 2007
Posts: 198
Dave137 is on a distinguished road
Smile How-To Get 2 Indicators on 1-seperate window??

Can somebody refresh my mind on how to get 2-indicators on one seperate window so they overlap each other??

Thanks for you assistance in advance!

Dave

Last edited by Dave137; 07-06-2008 at 09:11 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1074 (permalink)  
Old 07-06-2008, 11:10 PM
Junior Member
 
Join Date: Jun 2008
Posts: 3
ryan56 is on a distinguished road
EA needed to open orders only

Hi All,

I was just wondering if anyone could help me create an EA that just opens 4 different orders at 00:00AM GMT for any pair.
1 lot buy
1 lot buy
1 lot sell
1 lot sell
to be opened all at 00:00GMT

thanks for assistance

Ryan56
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1075 (permalink)  
Old 07-07-2008, 01:47 AM
Senior Member
 
Join Date: Feb 2007
Posts: 716
FerruFx is on a distinguished road
Quote:
Originally Posted by bdht View Post
Hi, Everyone.

Recently I was trying to make a simple EA that would work on an arrow-based indicator. I am trying to make the EA to maintain one order at any given time. If the arrow points down, the previous buy order is closed and sell order is opened. If the arrow points up, the previous sell order is closed and buy order is opened. I am using the tester (visualization mode) to verify my code. It seems that no matter how I try, the EA does not close and open the positions when arrow indicator points up or down. The back test confirms that the EA is not working properly. Instead of opening and closing the orders at the arrow points shown by the indicator, the EA closes/opens order at some different time. I cannot understand why my code doesn't work.

In the beginning of start statement, I have the following code:

if (Time[0] == savedTime) {
return (0);
} else {
savedTime = Time [0];
}

This (I hope) will ensure that the code in the start statement is executed only when new bar has formed. Later in the body of the start subroutine, I query the indicator with iCustom function. The request looks as below:

iCustom (... 1)

The last argument of one specifies the previous formed bar, which is why it is not 0. Yet later I close the opened order with OrderClose and open new one with OrderSend. I suppose that both functions must be able to execute instantaneously.

The bottom line is: I am trying to create an EA based on arrow indicator. The indicator points either up or down. The way I see it (and I am probably incorrect), the only thing that I need to do is to close previous order and open new one when the next bar has formed. I would greatly appreciate any input into this problem.

Thanks to all.
If you look at your signal only once a bar and your "system" close and reverse when the signal change, it's important to check for exit BEFORE check for entry. If not, when a new entry signal is there, the EA can't enter the trade because the previous one is still open. And when the EA close the position, it will enter only at the next bar because it come in this part of code only once a bar.

Hope that make sense (with my english!).

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1076 (permalink)  
Old 07-07-2008, 06:45 AM
Administrator
 
Join Date: Sep 2005
Posts: 15,986
Blog Entries: 70
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
Quote:
Originally Posted by Dave137 View Post
Can somebody refresh my mind on how to get 2-indicators on one seperate window so they overlap each other??

Thanks for you assistance in advance!

Dave
Look at this page: filters indicators
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1077 (permalink)  
Old 07-07-2008, 03:44 PM
nondisclosure007's Avatar
Member
 
Join Date: Apr 2007
Posts: 82
nondisclosure007 is on a distinguished road
Well, this will fix your new bar problem (got it from an article out at mql4.com):
Code:
bool funcIsNewBar()
   {
   bool res=false;
   
   // the array contains open time of the current (zero) bar
   // for 7 (seven) timeframes
   static datetime _sTime[7];  
   int i=6;
   int timeFrame = Period();
   
   switch (timeFrame) 
      {
      case 1  : i=0; break;
      case 5  : i=2; break;
      case 15 : i=3; break;
      case 30 : i=4; break;
      case 60 : i=5; break;
      case 240: i=6; break;
      case 1440:break;
      default:  timeFrame = 1440;
      }
//----
   if (_sTime[i]==0 || _sTime[i]!=iTime(Symbol(),timeFrame,0))
      {
      _sTime[i] = iTime(Symbol(),timeFrame,0);
      res=true;
      }
      
//----
   return(res);   
   }
Call this function like this
Code:
int start()
{
     if (funcIsNewBar)
     {
          //run some code
     }
     return (0);
}
That'll get code to run ONLY when there is a new bar.

What you need to do is find out in the data window of MT4 what the values are when there is NO arrow being put on the chart by your indicator. For example, the indicator may may have 0's or may be blank.

So all you do then is call the value of the indicator at each open
Code:
varMyIndieValue=iCustom(<blah blah>);
if (varMyIndieValue>0) //there's an arrow
{ 
     //run some code
}


Quote:
Originally Posted by bdht View Post
Hi, Everyone.

Recently I was trying to make a simple EA that would work on an arrow-based indicator. I am trying to make the EA to maintain one order at any given time. If the arrow points down, the previous buy order is closed and sell order is opened. If the arrow points up, the previous sell order is closed and buy order is opened. I am using the tester (visualization mode) to verify my code. It seems that no matter how I try, the EA does not close and open the positions when arrow indicator points up or down. The back test confirms that the EA is not working properly. Instead of opening and closing the orders at the arrow points shown by the indicator, the EA closes/opens order at some different time. I cannot understand why my code doesn't work.

In the beginning of start statement, I have the following code:

if (Time[0] == savedTime) {
return (0);
} else {
savedTime = Time [0];
}

This (I hope) will ensure that the code in the start statement is executed only when new bar has formed. Later in the body of the start subroutine, I query the indicator with iCustom function. The request looks as below:

iCustom (... 1)

The last argument of one specifies the previous formed bar, which is why it is not 0. Yet later I close the opened order with OrderClose and open new one with OrderSend. I suppose that both functions must be able to execute instantaneously.

The bottom line is: I am trying to create an EA based on arrow indicator. The indicator points either up or down. The way I see it (and I am probably incorrect), the only thing that I need to do is to close previous order and open new one when the next bar has formed. I would greatly appreciate any input into this problem.

Thanks to all.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1078 (permalink)  
Old 07-07-2008, 04:16 PM
Member
 
Join Date: Sep 2007
Posts: 67
Ronald Raygun is on a distinguished road
Manage Multiple trades

Hey all,

I'm trying to develop an EA which can theoretically enter an infinite amount of trades, and manage for each trade the:
  1. Trailing Stop
  2. Move to BE
  3. ATR-Trailing Stop
  4. etc

I know EAs like swiss army and manageTP can do this. I don't know how.

Any suggestions?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1079 (permalink)  
Old 07-16-2008, 11:44 AM
Member
 
Join Date: Jun 2006
Posts: 42
rarango is on a distinguished road
need help writing code for stoping trading after a loss

Hi,

I need to write code so that an expert stops trading for a specific number of hours after one loss or after two or three consecutive losses.

can some body help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1080 (permalink)  
Old 07-21-2008, 04:00 AM
Junior Member
 
Join Date: Jan 2007
Posts: 2
jawas_ftsm is on a distinguished road
Coding for Martinggle with hedging closed

Hi Team,

i would like to seek a code that can provide me to the solution of my stategies below;

examples;
martingle concept-
TP = 23 pips
Pip gaps = 20
OP buy EU 0.1,0.2,0.4,0.8,1.6 lot
1. if layer on lot 1,6 floating more than -20pips then OP Sell EU with 12.8lot (tp 23).
2. if layer 12.8 lot hit TP close all EU position.
3. if 12.8 lot pip=0 then close position on Sell EU only.
4. repeat situation 1 until 3 again if the condition apply.

Need your favour to advise me on the function and codes.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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 On
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 04:22 PM


All times are GMT. The time now is 10:31 PM.



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