Forex



Go Back   Forex Trading > Downloads > Indicators - Metatrader 4
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
  #1 (permalink)  
Old 08-22-2006, 01:03 PM
Junior Member
 
Join Date: Jul 2006
Posts: 4
Nightmasks is on a distinguished road
Detecting new bar (Indicator / EA?)

I need to detect when the new bar for any timeframe commences and then put out an alert if a certain condition is met. I am new to this and just completed my first indicator but my alerts occur for every tick.

Also, how do I return a specific bar's commencing server or local time. Does each bar have a time "label"?

The documentation tells me how to get current time in seconds since 1970 and there are functions to extract components such as hour or day. Is there any function that can convert to a specified format?

All help appreciated.
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
  #2 (permalink)  
Old 08-22-2006, 01:54 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 724
Kalenzo is on a distinguished road
Quote:
Originally Posted by Nightmasks
I need to detect when the new bar for any timeframe commences and then put out an alert if a certain condition is met. I am new to this and just completed my first indicator but my alerts occur for every tick.
define lastBar before Start function and in the start function check:
if(Bars>lastBar)
{
alert me
lastBar = Bars;
}
Quote:
Originally Posted by Nightmasks
Also, how do I return a specific bar's commencing server or local time. Does each bar have a time "label"?
Yes, u can use Time[] array or iTime() function

Quote:
Originally Posted by Nightmasks
The documentation tells me how to get current time in seconds since 1970 and there are functions to extract components such as hour or day. Is there any function that can convert to a specified format?
All help appreciated.
To what format do u want to convert it? It returns standard timestamp, and as we know timestamp can be converted to any format as u wish.

Regards
Kale
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
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
  #3 (permalink)  
Old 08-22-2006, 01:57 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,083
Blog Entries: 243
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 Nightmasks
I need to detect when the new bar for any timeframe commences and then put out an alert if a certain condition is met. I am new to this and just completed my first indicator but my alerts occur for every tick.

Also, how do I return a specific bar's commencing server or local time. Does each bar have a time "label"?

The documentation tells me how to get current time in seconds since 1970 and there are functions to extract components such as hour or day. Is there any function that can convert to a specified format?

All help appreciated.
You may use iClose():

Code:
double iClose( string symbol, int timeframe, int shift),
where shift is number of bar starting from 0 (curent bar).

Or indicator/EA may look back to some bars to search the condition:


Code:
  int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//----
   for(int i = 0 ;i < limit ;i++)
   {
      double f1u = iCustom(...,i);
      double f2u = iCustom(...,i+1);
So if you want to find the bar in the history which meets your condition so it is not difficult.
If you know the time for the bar (11:00 GMT for example) and you want to find condition for that bar so I don't know.
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
  #4 (permalink)  
Old 08-22-2006, 01:58 PM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 319
phoenix is on a distinguished road
it's here too

How to alert only at candle close
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
  #5 (permalink)  
Old 08-22-2006, 02:00 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,083
Blog Entries: 243
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 Kalenzo
define lastBar before Start function and in the start function check:
if(Bars>lastBar)
{
alert me
lastBar = Bars;
}

Yes, u can use Time[] array or iTime() function


To what format do u want to convert it? It returns standard timestamp, and as we know timestamp can be converted to any format as u wish.

Regards
Kale
We answered simultaniously with Kalenzo.
So forget about my answer as i am not a coder.
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
  #6 (permalink)  
Old 08-22-2006, 02:41 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Cool New Bar Mystery

I'm writing right now an article about "New Bar Mystery" at: http://www.metatrader.info/node/151

Hope it clears the idea!
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by codersguru; 08-22-2006 at 03:08 PM. Reason: wrirint
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
  #7 (permalink)  
Old 08-22-2006, 02:44 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 724
Kalenzo is on a distinguished road
Quote:
Originally Posted by codersguru
I'm wrirint right now an article about "New Bar Mystery" at: http://www.metatrader.info/node/151

Hope it clears the idea!
Great! Once and for all
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
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
  #8 (permalink)  
Old 08-23-2006, 09:58 AM
Junior Member
 
Join Date: Jul 2006
Posts: 4
Nightmasks is on a distinguished road
Thanks for all the help - that's excellent. I learned heaps today.

Also, the TimeMinute & other Time* functions solved my formatting fo specific bar. I wrote a simple format function using these.
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
  #9 (permalink)  
Old 08-23-2006, 11:29 AM
cubesteak's Avatar
Senior Member
 
Join Date: Jul 2006
Location: Southern California
Posts: 160
cubesteak is on a distinguished road
Quote:
Originally Posted by codersguru
I'm writing right now an article about "New Bar Mystery" at: http://www.metatrader.info/node/151

Hope it clears the idea!
Hey, I could have really used that about a week ago! At least now I know my conclusions were right!

WOOOT! Thanks for the excellent info, as always cg..
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
  #10 (permalink)  
Old 08-23-2006, 03:24 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Quote:
Originally Posted by cubesteak
Hey, I could have really used that about a week ago! At least now I know my conclusions were right!

WOOOT! Thanks for the excellent info, as always cg..
You're welcome cubesteak! I have good news for you
I've written 2 parts in the subjected you have requested:

Create your own MetaTrader extension (dll) - Part 1
Create your own MetaTrader extension (dll) - Part 2

There'll be another part (or 2) which I'm writing them!

Hope you enjoy them!
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
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


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
Detecting start of new candle? SteveBrown Expert Advisors - Metatrader 4 13 10-01-2008 10:20 PM
Detecting price trend independent of a specific time frame gee Metatrader 4 4 02-24-2007 05:53 PM


All times are GMT. The time now is 04:43 PM.



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