• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 10:55pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 10:55pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

What is a bar called where OHLC has the same value? 8 replies

OHLC Bar width 6 replies

Previous Bar OHLC 4 replies

Looking for OHLC bar drawing code 0 replies

Pin bar, pin bar, pin bar 0 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: previous bar OHLC
Exit Attachments

previous bar OHLC

  • Last Post
  •  
  • Page 1 2
  • Page 1 2
  •  
  • Post #1
  • Quote
  • First Post: Dec 16, 2008 1:21pm Dec 16, 2008 1:21pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Hi,

Is there any possibility to make MT4 to display OHLC data of the previous bar/candle instead of the currently developing one in the upper left corner?
Or maybe there is an indicator posted somewhere, but I couldn't find it.

cheers
Thomas
  • Post #2
  • Quote
  • Dec 16, 2008 1:26pm Dec 16, 2008 1:26pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
This one is easy. It would be a piece of code like:

Inserted Code
Comment(Open[1],High[1],Low[1],Close[1]);

and it would display right below the current OHLC
  • Post #3
  • Quote
  • Dec 16, 2008 1:56pm Dec 16, 2008 1:56pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Quoting LongToBeFree
Disliked
This one is easy. It would be a piece of code like:

Inserted Code
Comment(Open[1],High[1],Low[1],Close[1]);
and it would display right below the current OHLC
Ignored

thank you very much,
but could you put it into code if it's not a problem for you?
I've been trying for a while- it compiles well but nothing comes up the screen after applying. I'm completely unfamiliar with mql structure and probably messed something up.
Thomas
  • Post #4
  • Quote
  • Dec 16, 2008 1:57pm Dec 16, 2008 1:57pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
Why dont you post the code you have now and I might help correct it.

You post code for free, not the other way around
  • Post #5
  • Quote
  • Dec 16, 2008 2:08pm Dec 16, 2008 2:08pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Quoting LongToBeFree
Disliked
Why dont you post the code you have now and I might help correct it.

You post code for free, not the other way around
Ignored
Actually there's nothing to show, I just tried to manipulate code of some other indicator, which is MT4 included, just deleted that code and inserted the line you suggested. Apparently there is some init() function and start () but I have no idea what to do with it. It's just a matter of trial and error for me.
I thought that it is as simple as in the case of C language for instance: main() and cout<"..." but it isn't. Or maybe it is but it's black magic for me.
I asked on the forum because I don't want to waste 2 days just to work out some simple line which I can live without.
Thomas
  • Post #6
  • Quote
  • Dec 16, 2008 2:28pm Dec 16, 2008 2:28pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
Try this:

Inserted Code
//+------------------------------------------------------------------+
//|                                                   GoHan OHLC.mq4 |
//|                                 Copyright © 2008, gohanforex.com |
//|                                        http://www.gohanforex.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, gohanforex.com"
#property link      "http://www.gohanforex.com"

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
managelowerstatus("http://www.gohanforex.com");
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   Comment(Open[1],High[1],Low[1],Close[1]);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Manage lower status                                              |
//+------------------------------------------------------------------+
void managelowerstatus(string addstatus)
   {
   ObjectDelete("Lower_Status");
   if(addstatus!="")
      {
      ObjectCreate("Lower_Status", OBJ_LABEL, 0, 0, 0);// Creating obj.
      ObjectSet("Lower_Status", OBJPROP_CORNER,3);    // Reference corner
      ObjectSet("Lower_Status", OBJPROP_XDISTANCE, 2);// X coordinate
      ObjectSet("Lower_Status", OBJPROP_YDISTANCE, 1);// Y coordinate
      ObjectSetText("Lower_Status", addstatus, 9, "Verdana", Yellow);
      }
   }
  • Post #7
  • Quote
  • Dec 16, 2008 3:02pm Dec 16, 2008 3:02pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Quoting LongToBeFree
Disliked
Try this:
Ignored

not working :[
Thomas
  • Post #8
  • Quote
  • Dec 16, 2008 3:23pm Dec 16, 2008 3:23pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
that's your whole post?

At least put up an error message or something
  • Post #9
  • Quote
  • Dec 16, 2008 3:57pm Dec 16, 2008 3:57pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Quoting LongToBeFree
Disliked
that's your whole post?

At least put up an error message or something
Ignored
There isn't any.
It compiles without any warning, but nothing happens after I apply it to a chart.
Thomas
  • Post #10
  • Quote
  • Dec 16, 2008 4:08pm Dec 16, 2008 4:08pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
Put up a screenshot with a chart that has the EA attached
  • Post #11
  • Quote
  • Dec 17, 2008 12:32pm Dec 17, 2008 12:32pm
  •  Oksana17
  • | Membership Revoked | Joined Sep 2007 | 903 Posts
Quoting thomass
Disliked
not working :[
Ignored
THAT'S A SIGN OF BAD PROGRAMMING!
Request custom Expert Advisor or Indicator: dostapyuk "at" gmail . com
  • Post #12
  • Quote
  • Dec 17, 2008 12:33pm Dec 17, 2008 12:33pm
  •  Oksana17
  • | Membership Revoked | Joined Sep 2007 | 903 Posts
Quoting LongToBeFree
Disliked
that's your whole post?

At least put up an error message or something
Ignored
Hi LongToBeFree,
You are supposed to check what You programmed before You send out the program.
Just my 2 cents
Request custom Expert Advisor or Indicator: dostapyuk "at" gmail . com
  • Post #13
  • Quote
  • Dec 17, 2008 3:36pm Dec 17, 2008 3:36pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
Quoting Oksana17
Disliked
Hi LongToBeFree,
You are supposed to check what You programmed before You send out the program.
Just my 2 cents
Ignored
Did you verify the code yourself? Until then, I would make sure that you're careful about libelous statements that you make.
  • Post #14
  • Quote
  • Dec 17, 2008 3:36pm Dec 17, 2008 3:36pm
  •  LongToBeFree
  • | Membership Revoked | Joined Oct 2008 | 613 Posts
Quoting Oksana17
Disliked
THAT'S A SIGN OF BAD PROGRAMMING!
Ignored
Are you implying that people should use the services of a spammer instead?

http://www.forexfactory.com/member.php?u=48267
  • Post #15
  • Quote
  • Dec 17, 2008 7:39pm Dec 17, 2008 7:39pm
  •  Zen_Leow
  • Joined Jun 2008 | Status: Programming for a better future. | 649 Posts
My guess is... you're using it as an indicator when LongToBeFree coded it as an EA. The code works fine if you're using it as an EA.

if its going to be used as an indicator, one line needs to be added near the top

Hope this helps.

regards,
Zen
Inserted Code
//+------------------------------------------------------------------+
//|                                                   GoHan OHLC.mq4 |
//|                                 Copyright © 2008, gohanforex.com |
//|                                        [url]http://www.gohanforex.com[/url] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, gohanforex.com"
#property link      "[url]http://www.gohanforex.com[/url]"
 
[b]#property indicator_chart_window[/b]
 
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
managelowerstatus("[url]http://www.gohanforex.com[/url]");
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   Comment(Open[1],High[1],Low[1],Close[1]);
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Manage lower status                                              |
//+------------------------------------------------------------------+
void managelowerstatus(string addstatus)
   {
   ObjectDelete("Lower_Status");
   if(addstatus!="")
      {
      ObjectCreate("Lower_Status", OBJ_LABEL, 0, 0, 0);// Creating obj.
      ObjectSet("Lower_Status", OBJPROP_CORNER,3);    // Reference corner
      ObjectSet("Lower_Status", OBJPROP_XDISTANCE, 2);// X coordinate
      ObjectSet("Lower_Status", OBJPROP_YDISTANCE, 1);// Y coordinate
      ObjectSetText("Lower_Status", addstatus, 9, "Verdana", Yellow);
      }
   }
Programming for a better future.
  • Post #16
  • Quote
  • Dec 18, 2008 4:44pm Dec 18, 2008 4:44pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Quoting Zen_Leow
Disliked
My guess is... you're using it as an indicator when LongToBeFree coded it as an EA. The code works fine if you're using it as an EA.

if its going to be used as an indicator, one line needs to be added near the top

Hope this helps.

regards,
Zen
Ignored
Works beautifuly.
Thank you very much
Thomas
  • Post #17
  • Quote
  • Dec 18, 2008 6:03pm Dec 18, 2008 6:03pm
  •  Zen_Leow
  • Joined Jun 2008 | Status: Programming for a better future. | 649 Posts
don't thank me, LongToBeFree was the one who wrote the code. I merely pointed out that its an EA and not an indicator.

Next time you get a piece of code, do a quick check and see if it has something like this

Inserted Code
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

that's tell tale sign the author is writing an EA.

Have fun. =)

regards,
Zen
Programming for a better future.
  • Post #18
  • Quote
  • Dec 18, 2008 8:18pm Dec 18, 2008 8:18pm
  •  Oksana17
  • | Membership Revoked | Joined Sep 2007 | 903 Posts
Quoting Zen_Leow
Disliked
My guess is... you're using it as an indicator when LongToBeFree coded it as an EA. The code works fine if you're using it as an EA.

if its going to be used as an indicator, one line needs to be added near the top

Hope this helps.

regards,
Zen
[code]
//+------------------------------------------------------------------+
//|...
Ignored
Hi Zen,
You are very smart.
I appreciate You.
Request custom Expert Advisor or Indicator: dostapyuk "at" gmail . com
  • Post #19
  • Quote
  • Dec 18, 2008 8:21pm Dec 18, 2008 8:21pm
  •  Oksana17
  • | Membership Revoked | Joined Sep 2007 | 903 Posts
LongToBeFree,
Fantastic work!
Request custom Expert Advisor or Indicator: dostapyuk "at" gmail . com
  • Post #20
  • Quote
  • Dec 19, 2008 5:41pm Dec 19, 2008 5:41pm
  •  thomass
  • | Joined Feb 2007 | Status: Member | 50 Posts
Quoting Zen_Leow
Disliked
don't thank me, LongToBeFree was the one who wrote the code. I merely pointed out that its an EA and not an indicator.

Next time you get a piece of code, do a quick check and see if it has something like this

Inserted Code
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
that's tell tale sign the author is writing an EA.

Have fun. =)

regards,
Zen
Ignored
I mean thank you all for your effort.
Saying that it's black magic for me I meant exactly that issues.
You know that it should go something like this but there is always a detail you are unaware of because of total lack of experience in programming mql.
Thomas
  • Platform Tech
  • /
  • previous bar OHLC
  • Reply to Thread
    • Page 1 2
    • Page 1 2
0 traders viewing now
  • More
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021