Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Change of bar versus each tick

  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    2

    Default Change of bar versus each tick

    What code do I need to use in order to perform actions only when a bar changes instead of when there is a new tick?

    Thanks,

    saintmo

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by saintmo View Post
    What code do I need to use in order to perform actions only when a bar changes instead of when there is a new tick?

    Thanks,

    saintmo
    Hi saintmo and welcome,

    You have to add a limitation per bar, when the actions have been applied.

    At the top, add :

    Code:
    extern int MaxActionsPerBar=1;
    int ActionsPerBar=0;
    int BarCount=-1;
    Before the actions add :

    Code:
    if(BarCount!=Bars){ActionsPerBar=0;BarCount=Bars;}
    In line, after the conditions required to apply the actions :

    Code:
    &&(ActionsPerBar<=MaxActionsPerBar)
    After the actions, add :

    Code:
    ActionsPerBar++;

  3. #3
    Junior Member
    Join Date
    Dec 2008
    Posts
    2

    Default

    funnyoo,

    Awesome. Thank you so much. I have been searching for how to do this for some time. I will give this a shot,

    Thanks again,

    saintmo

Similar Threads

  1. Spot Forex Versus Currency Futures
    By painofhell in forum Trading discussion
    Replies: 0
    Last Post: 08-27-2014, 17:19
  2. What does old tick mean!
    By wannaberich in forum Expert advisors backtesting
    Replies: 2
    Last Post: 07-12-2012, 20:03
  3. Tick Scalper
    By funyoo in forum Expert advisors backtesting
    Replies: 0
    Last Post: 07-15-2010, 18:02
  4. Tick charts
    By Dutchess in forum MQL programming
    Replies: 1
    Last Post: 12-19-2009, 16:27

Tags for this Thread

change, how to, thank you, time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •