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
  #1331 (permalink)  
Old 10-07-2008, 12:16 AM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 347
cockeyedcowboy is on a distinguished road
Quote:
Originally Posted by InTrance View Post
Its very simple. Just do something like:

if (iBars>Bars){

Code to execute when new bar arrives;

Bars=iBars;

}
InTrance

As you well know, Both 'Bars' and 'iBars' are key words in MT (iBars() being a builtin function), and should not be used in the fastion indicated, it will cause an error as you can not set the key word 'Bars' to another value. and the use of iBars as a veriable name would be confusing, as well. I understand were your coming from but someone not well versed in the MQ language will be misleaded with your choice of varible naming here, especially if they carry them over in their code.

Keit

Last edited by cockeyedcowboy; 10-07-2008 at 12:18 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1332 (permalink)  
Old 10-07-2008, 07:48 AM
Junior Member
 
Join Date: Aug 2006
Posts: 11
callan300 is on a distinguished road
Hello,

Thanks for the reply. So how is it really done ?

What I need to do is to check if the bar has ended on a different time frame.
For exemple, with the chart on 30 MIN I want to check if we have a new bar on the 240 MIN

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1333 (permalink)  
Old 10-07-2008, 09:40 AM
Junior Member
 
Join Date: Oct 2008
Posts: 16
WorldUser is on a distinguished road
Quote:
Originally Posted by callan300 View Post
Hello,

Thanks for the reply. So how is it really done ?

What I need to do is to check if the bar has ended on a different time frame.
For exemple, with the chart on 30 MIN I want to check if we have a new bar on the 240 MIN

Thanks!
Do you plan to use for the checkin of the fractal system?...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1334 (permalink)  
Old 10-10-2008, 06:06 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 362
Beno is on a distinguished road
Well I'm back for help again lol but there's no suprise there

could someone please post the code for opening a position 1min after a new bar is open.
I have been trying to do this but don't know where to start. I have been looking at it for the cat of nine tails experiment it migt be a waste of energy but we have to try these things. unless someone else have done this before if please let be know you results.
T1=1 min
T2=2min etc


if (minute() =T1>open && Price > open = Long);

I'm rubbish at this coding lark
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1335 (permalink)  
Old 10-10-2008, 09:43 PM
Senior Member
 
Join Date: Feb 2006
Posts: 559
Michel is on a distinguished road
Something like this ?
PHP Code:
if(TimeCurrent() == Time[0] + T1 60)
{


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1336 (permalink)  
Old 10-10-2008, 09:52 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 362
Beno is on a distinguished road
thanks Michel

i will give it ago
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1337 (permalink)  
Old 10-11-2008, 04:46 AM
Member
 
Join Date: May 2008
Posts: 30
frankychen is on a distinguished road
Exclamation Help, Very difficult question!!!!

How can I let one indicator to show another indicator's Multi Timeframe
situation and give us alert?


For example:

A indicatorOnly one timeframe situation shown)
functionA (it's a complex program)

B IndicatorShow A indicator's different timeframe situation)
functionA M5 situation
functionA M15 situation
functionA M30 situation
functionA H1 situation
functionA H4 situation
functionA D1 situation
......


Best regards

Franky

Last edited by frankychen; 10-11-2008 at 05:31 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1338 (permalink)  
Old 10-11-2008, 11:02 AM
Senior Member
 
Join Date: Nov 2006
Posts: 215
luxinterior is on a distinguished road
You could try looking in the MetaEditor help file at the iCustom function. That should help you accomplish what you're after.

Good Luck

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1339 (permalink)  
Old 10-11-2008, 02:26 PM
Senior Member
 
Join Date: Feb 2007
Posts: 947
FerruFx is on a distinguished road
Quote:
Originally Posted by Michel View Post
Something like this ?
PHP Code:
if(TimeCurrent() == Time[0] + T1 60)
{


You must give more room for the condition because ticks don't come each second. If there's no tick at bar opentime + Xseconds, the condition will be false.

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
  #1340 (permalink)  
Old 10-11-2008, 10:15 PM
Senior Member
 
Join Date: Feb 2006
Posts: 559
Michel is on a distinguished road
Quote:
Originally Posted by FerruFx View Post
You must give more room for the condition because ticks don't come each second. If there's no tick at bar opentime + Xseconds, the condition will be false.

FerruFx
You are absolutely right. But it was just to give some idea. I think the problem for Beno is to avoid the TradeContextBuzy, opening several positions at the open of a bar.
I don't think that to use a timer is a good idea. For this kind of problem, or Requote etc, usually I set a flag at the open of the bar, and this flag is reset when the order is opened. Until the position is opened, a try is done every tick. Something like this:
PHP Code:
if(Time[0] > BarTime)
{
   
BarTime Time[0];
   if(....) 
OpenLong true;
}
if(
OpenLongOpenLong OrderSend(.....) < 0
I use the same kind of technique to close many positions and it works very well :
PHP Code:
.....
   if(
CloseAllLongsCloseAll(OP_BUY);      
   if(
CloseAllShortsCloseAll(OP_SELL);
}
   
void CloseAll(int Type)
{
   
int cnt 0;
   for(
int i OrdersTotal(); >= 0--)
   {
      if(!
OrderSelect(iSELECT_BY_POS)) continue;
      if(
OrderSymbol() != Symbol()) continue;
      if(
OrderMagicNumber() != Magic) continue;
      if(
OrderType() != Type) continue;
      
cnt ++;
      
OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), SlippageWhite);
   }
   if(
Type == OP_BUYCloseAllLongs = (cnt 0);
   if(
Type == OP_SELLCloseAllShorts = (cnt 0);

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:19 PM.



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