how to "not enter the market" if i just took a trade?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #82315 quote
    jebus89
    Participant
    Master

    I want the rule to not enter the market if i have taken a trade within say the last 10 bars.

    By “taken a trade” i mean if i have just finished a trade. If the trade was profitable i  dont want to enter the market within the next 10 bars. If there is no way of seeing whether or not the last trade was a profit or loss  i would still try to backtest the rule.

    possible?

    #82316 quote
    robertogozzi
    Moderator
    Master
    1. You have to use a variable to start counting bars when you exit a trade (you have to check you are NOT LONGONMARKET now but were LONGONMARKET the previous bar) and set another variable to disable trading
    2. After 10 bars you have to allow trading again
    ONCE BarCount = 0
    ONCE TradeON  = 1           //1=trading allowed     0=trading disbaled
    IF LongOnMarket AND Not LongOnMarket[1] THEN
       TradeON  = 0             //disable trading
       BarCount = 0             //reset counter
    ENDIF
    IF Not LongOnMarket THEN    //Increase counter when not on market
       BarCount = BarCount + 1
    ENDIF
    IF BarCount > 10 THEN
       TradeON = 1
    ENDIF

    you’ll also have to add “AND TradeOn” to your condition to enter a new trade.

    jebus89 thanked this post
    #82328 quote
    GraHal
    Participant
    Master

    added as Row 71 to 

    Snippet Link Library

    #82341 quote
    jebus89
    Participant
    Master

    Big thanks

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

how to "not enter the market" if i just took a trade?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jebus89 @jebus89 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by jebus89
7 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/08/2018
Status: Active
Attachments: No files
Logo Logo
Loading...