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
  #1961 (permalink)  
Old 08-05-2009, 02:41 PM
Junior Member
 
Join Date: Apr 2008
Posts: 4
pete_36 is on a distinguished road
Indicator readings

Hi,

Would anyone tell me how to get the highest & lowest reading of an indicator over the past 30 days!

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
  #1962 (permalink)  
Old 08-05-2009, 02:49 PM
Junior Member
 
Join Date: Dec 2008
Posts: 2
toiii is on a distinguished road
what is the code for
buy area = daily open price + (20% * daily open)
sell area = daily open price - (20% * daily open)
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
  #1963 (permalink)  
Old 08-05-2009, 04:12 PM
Junior Member
 
Join Date: Apr 2008
Posts: 4
pete_36 is on a distinguished road
Quote:
Originally Posted by toiii View Post
what is the code for
buy area = daily open price + (20% * daily open)
sell area = daily open price - (20% * daily open)
Here we go,

Code:
//--open value for the current day, set the 0 to 1 for the previous day open
   
   double DO=iOpen(NULL, PERIOD_D1, 0);    
   
   if(Bid>=(DO+DO*0.2))
      OrderSend(set the criteria for BUY);
   
   if(Bid<=(DO-DO*0.2))
      OrderSend(set the criteria for SELL);
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
  #1964 (permalink)  
Old 08-05-2009, 04:23 PM
Senior Member
 
Join Date: Apr 2008
Location: Rawalpindi
Posts: 106
arshadFX is on a distinguished road
Quote:
Originally Posted by toiii View Post
what is the code for
buy area = daily open price + (20% * daily open)
sell area = daily open price - (20% * daily open)
#property copyright "Copyright © 2009, Arshed Qureshi. ArshadFX"
#property indicator_chart_window


extern int Percent = 20;

// --- Main Function call -----------------------------------------------------
int start()
{
double high = iHigh(Symbol(),PERIOD_D1,0);
double low = iLow(Symbol(),PERIOD_D1,0);
double Range =(high-low); if(Digits<4) Range=Range*100; else Range=Range*10000;
double GetPer = Percent*(Range/100);

// ----------------------------------------------------------------------------
Comment ("High : ",high,", Low : ",low,", Range : ",Range,"\n",Percent,"% : ",GetPer);
return(0);
}
// --- End of Main 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
  #1965 (permalink)  
Old 08-05-2009, 05:28 PM
Junior Member
 
Join Date: Jan 2009
Posts: 2
soak614 is on a distinguished road
Can anyone to help coding this EA?

Hello,

I'm currently trading with a martingale EA which will open max 4 levels of orders. I just think of a hedging strategy that may reduce the risk of using this EA. Below is a description of my strategy:

1. The hedging EA will monitor the drawdown of the opening orders. If the total floating losses is greater than a pre-determined amount, it will trigger the EA to open a hedged order in opposite to the opening orders.

2. The lot size of the hedged order is calculated based on a multiple (user can set the multiple) of the lot size of the last opening order (e.g. if the lot size of the last level order is 1.6 and the multiple is set at 2, then the hedged order will be open with lot size at 3.2.

3. When the hedged order returned to its opening level, the hedged order will be closed automatically.

4. When the overall basket (the opening orders + the hedged order) reaches a pre-determined net profit amount, all orders will be closed.

I wonder if some good programmer can code this hedging EA for me. I think it will be very useful for other martingale EA as well. Thanks a lot!

Best regards,

Wallace
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
  #1966 (permalink)  
Old 08-05-2009, 05:33 PM
Junior Member
 
Join Date: Dec 2008
Posts: 2
toiii is on a distinguished road
whoa..
thanks guys..
how about buy stop and sell stop?
just change "BUY" over there?
just want 2 positions only for 1 pairs, not more than that..
sorry, still newbie..
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
  #1967 (permalink)  
Old 08-05-2009, 06:51 PM
Junior Member
 
Join Date: May 2009
Posts: 9
liew_stanley is on a distinguished road
How to code this indis into EA ?

Hi, i'm a new learner and interested to learn mql, can someone tell me how to code this into EA ?

extern int Fast.MA.Period = 5;
extern int Slow.MA.Period = 34;
extern int Signal.period = 5;

//---- buffers
double Buffer1[],
Buffer2[],
b2[],
b3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators

// two additional buffers used for counting

IndicatorBuffers(4);


IndicatorShortName("MA_5_34");

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(0,242); // down 226 234 242
SetIndexBuffer(0,b2);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(1,241); //UP 225 233 241
SetIndexBuffer(1,b3);

// These buffers are not plotted, just used to determine arrows

SetIndexBuffer (2,Buffer1);
SetIndexBuffer (3,Buffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, counted_bars=IndicatorCounted();
double MA5,MA34;
int limit=Bars-counted_bars;
Print(" print limit = ", limit);
if(counted_bars>0) limit++;
<----can someone explain to me what it means ?

// Main line
for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
MA5=iMA(NULL,0,Fast.MA.Period,0,MODE_SMA,PRICE_MED IAN,i);
MA34=iMA(NULL,0,Slow.MA.Period,0,MODE_SMA,PRICE_ME DIAN,i);

Buffer1[i]=MA5-MA34;
}

// Signal line

for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
Buffer2[i]=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA ,i);
}
<----can someone explain to me what it means ?
// Arrows

for(i=0; i<limit; i++)
{
if(Buffer1[i] > Buffer2[i] && Buffer1[i-1] < Buffer2[i-1])
b2[i] = High[i]+10*Point;
if(Buffer1[i] < Buffer2[i] && Buffer1[i-1] > Buffer2[i-1])
b3[i] = Low[i]-10*Point;
<----can someone explain to me what it means ?
}

//----
return(0);
}

Thanks guys =^_^=
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
  #1968 (permalink)  
Old 08-05-2009, 07:32 PM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 158
Roger09 is on a distinguished road
Quote:
Originally Posted by liew_stanley View Post
if(counted_bars>0) limit++;[/u][/b] <----can someone explain to me what it means ?

// Main line
for(i=0; i<limit; i++) <----can someone explain to me what it means ?
// Signal line

for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
Buffer2[i]=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA ,i);
}
<----can someone explain to me what it means ?
// Arrows

for(i=0; i<limit; i++)
{
if(Buffer1[i] > Buffer2[i] && Buffer1[i-1] < Buffer2[i-1])
b2[i] = High[i]+10*Point;
if(Buffer1[i] < Buffer2[i] && Buffer1[i-1] > Buffer2[i-1])
b3[i] = Low[i]-10*Point;
<----can someone explain to me what it means ?


Thanks guys =^_^=
It's easy.
When you start your indi, Bars=1000 (for example) and counted_bars=0. So limit=1000 and your indi calculates all 1000 bars. After this counted_bars=1000, and every new tick indi calculates only last (zero) bar. When next bar comes, limit=1 and indi recalculates two last bars.
b3[i] = Low[i]-10*Point; - it's just a line 10 points lower then bar's minimum.
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
  #1969 (permalink)  
Old 08-05-2009, 07:49 PM
Junior Member
 
Join Date: May 2009
Posts: 1
fxcourt is on a distinguished road
Quote:
Originally Posted by liew_stanley View Post
Hi, i'm a new learner and interested to learn mql, can someone tell me how to code this into EA ?

extern int Fast.MA.Period = 5;
extern int Slow.MA.Period = 34;
extern int Signal.period = 5;

//---- buffers
double Buffer1[],
Buffer2[],
b2[],
b3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators

// two additional buffers used for counting

IndicatorBuffers(4);


IndicatorShortName("MA_5_34");

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(0,242); // down 226 234 242
SetIndexBuffer(0,b2);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(1,241); //UP 225 233 241
SetIndexBuffer(1,b3);

// These buffers are not plotted, just used to determine arrows

SetIndexBuffer (2,Buffer1);
SetIndexBuffer (3,Buffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, counted_bars=IndicatorCounted();
double MA5,MA34;
int limit=Bars-counted_bars;
Print(" print limit = ", limit);
if(counted_bars>0) limit++;
<----can someone explain to me what it means ?

// Main line
for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
MA5=iMA(NULL,0,Fast.MA.Period,0,MODE_SMA,PRICE_MED IAN,i);
MA34=iMA(NULL,0,Slow.MA.Period,0,MODE_SMA,PRICE_ME DIAN,i);

Buffer1[i]=MA5-MA34;
}

// Signal line

for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
Buffer2[i]=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA ,i);
}
<----can someone explain to me what it means ?
// Arrows

for(i=0; i<limit; i++)
{
if(Buffer1[i] > Buffer2[i] && Buffer1[i-1] < Buffer2[i-1])
b2[i] = High[i]+10*Point;
if(Buffer1[i] < Buffer2[i] && Buffer1[i-1] > Buffer2[i-1])
b3[i] = Low[i]-10*Point;
<----can someone explain to me what it means ?
}

//----
return(0);
}

Thanks guys =^_^=

If you want to use this indicator in an ea you can use the icustom() function to access it. you dont really need to understand any of the code of the indicator, just the data that it spits out. At least thats the easy way to do it.
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
  #1970 (permalink)  
Old 08-05-2009, 08:27 PM
Junior Member
 
Join Date: May 2009
Posts: 9
liew_stanley is on a distinguished road
Quote:
Originally Posted by fxcourt View Post
If you want to use this indicator in an ea you can use the icustom() function to access it. you dont really need to understand any of the code of the indicator, just the data that it spits out. At least thats the easy way to do it.
Meaning to say, use the function icustom() in the EA to recall the indis ? how should the coding to be written in the EA ? can give me some guide ?

Many 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
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: 2 (1 members and 1 guests)
elihayun
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 06:42 PM.



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