Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLong and Entershot for several trades then stop completely

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

    EnterLong and Entershot for several trades then stop completely

    I have a logic that enter long and enter short when a condition is met. However, after running for long time.. the logic doesn't work at all.. no more long or short is place. Any sample codes? Also, how to set stop loss and take profit when an order is placed. Any sample code?


    if (isBullishTrend)
    {

    EnterLong(Convert.ToInt32(1));
    Print(string.Format("Time:{0}\t Enter Long. Prevclose={1:0.00} curClose={2:0.00}", Time[0], pcloseValue, closeValue));

    }

    // Place short order
    else if (isBearishTrend)
    {

    EnterShort(Convert.ToInt32(1));
    Print(string.Format("Time:{0}\t Enter Short. Prevclose={1:0.00} curClose={2:0.00}", Time[0], pcloseValue, closeValue));
    }​



    #2
    Hello, thanks for writing in. The strategy does not implement any limitations on the number of trades that are placed. Print out the value of isBullishTrend and isBearishTrend to see what the value of these booleans are, so above all this code, add:

    Print("isBullishTrend " + isBullishTrend);
    Print("isBearishTrend " + isBearishTrend);

    This will help you see why these entry signals are no longer being reached after a period of time.

    Comment


      #3
      Thank you the reply. Though I still can't find why it stops by itself.

      Another question I have is how to set StopLoss or TakeProfit after EnterLong() or EnterShort()? I got an system error trying to set StopLoss and TakeProfit when EnterLong/EnterShort is ececuted.

      Comment


        #4
        Hi, you will need to call SetStopLoss() and SetProfitTarget() before calling the entry order. This will arm the stop and target to be applied to the next submitted order.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        48 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        66 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X