Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Newbie help

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

    Newbie help

    Hi!

    So i'm trying to make a Strategy with the Crossing of MacD, alone the MacD isn't good and will only give a 48% winrate.
    Now i want to filter out some of the bad trades using the 200EMA, Only going Short when the price is below and only going long when the price is above.
    Like seen in this video ; https://www.youtube.com/watch?v=nmffSjdZbWQ&t=351s

    I've tried putting it in a group with a 1% above or below seeing i would like to trade the trend and not a range.

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if ((CrossAbove(MACD1.Default, MACD1.Avg, 1))
    // Condition group 1
    || ((Close[0] * 1) > EMA1[0]))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    // Set 2
    if ((CrossBelow(MACD1.Avg, MACD1.Default, 1))
    // Condition group 1
    && ((Close[0] * 1) < EMA1[0]))
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), "");
    }

    }

    But this doesn't solve it and the script will still go long while under the 200ema.

    Any advice?
    Thanks!

    #2
    Welcome to the forums Unxander!

    Code:
    if ((CrossAbove(MACD1.Default, MACD1.Avg, 1))
    // Condition group 1
    || ((Close[0] * 1) &gt; EMA1[0]))
    This condition checks if there is a corssover OR if the current market price (Close[0)] times 1 is greater than the EMA value. This is not factoring a percentage of the close being greater than the EMA and since you are checking OR (if any) ether condition can be true

    To set up a condition factoring 1%, please see the attached screenshot.

    If you are simply trying to set up entry conditions, I suggest checking if the strategy position is flat before calling EnterLong/EnterShort. (Positions will reverse if EnterLong/EnterShort is called in the opposite direction.) Please see "Creating market position comparisons" in our help guide page below.



    If you have not already seen it, please see our Strategy Builder 301 tutorial for a full walk through on using this tool.



    We look forward to assisting.
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    24 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    120 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X