Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One per Bar

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    One per Bar

    Hello,

    please I have a dub.

    I'm developing a strategy in Ticks. When start a bar (ex. 5 min.), in a certain moment an "indicator > Value" and give the signal. I would like to fix this price.

    My question: Is there a specify function "One per Bar" or may I use variable?

    This is my propose (CalculateOnBarClose = false)

    How can you see (in red color) a variable go=1 every first tick of every candle and go=0 when there is the first signal of the indicator. It work fine but maybe there is a better function.

    Many thanks!
    ================================================== =======

    protected override void OnBarUpdate()
    {

    if (FirstTickOfBar)
    {
    DetectSignalUp = 1;
    DetectSignalDown = 1;

    }
    if (sCandles.SpreadHigh[0]>= LevSpreadCS)
    {
    if (DetectSignalUp == 1)
    {
    extremeRed = GetCurrentBid();
    Print (Time[0].ToString() + " | " + extremeRed + " | Extreme UP red arrow");
    DrawTriangleDown("My triangle down" + CurrentBar, false, 0, extremeRed, Color.Red);
    DetectSignalUp = 0;
    }
    }

    else if (sCandles.SpreadLow[0]<= LevSpreadCSLow)
    {
    if (DetectSignalDown == 1)
    {
    extremeGreen = GetCurrentAsk();
    DrawTriangleUp("My triangle up" + CurrentBar, false, 0, extremeGreen, Color.Lime);
    Print (Time[0].ToString() +" | " + extremeGreen + " | Extreme DOWN green arrow");
    DetectSignalDown = 0;

    }
    }
    }

    #2
    Hello ClauTrade,

    Thank you for your post.

    In order to have the signal once per bar utilizing FirstTickOfBar is the correct function.

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    46 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X