how to temporarily stop auto trading?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #29017 quote
    ccskycc101
    Participant
    New

    what is the code for ‘temporarily stop trading’ for 3 or 4 hours if a stop loss was activated?

    #29021 quote
    Elsborgtrading
    Participant
    Veteran

    something like (i did not test it)

    //1H TF
    once x=1
    positionsize =1
    if condition then
    buy positionsize*x contract at market
    endif
    
    set target point 30
    set stoploss point 10
    
    if strategyprofit<0 then 
    x=0
    if tradeindex<4
    then x=x
    else
    x=1
    endif
    endif
    
    
    Nicolas thanked this post
    #29121 quote
    Nicolas
    Keymaster
    Master

    If you are trading the 1 hour timeframe, you can simply use TRADEINDEX keyword, that give you the barindex number where the trades were launched at market. Then you only need to make differences between the current barindex and the last tradeindex to know if there is already 4 bars elapsed.

    #30606 quote
    ccskycc101
    Participant
    New

    still didnt make it

    set stop ploss 50 then set my system to stop one hour in 5 min timeframe?

    #30806 quote
    Nicolas
    Keymaster
    Master

    1 hour is 12 bars of 5 minutes.

    So your boolean condition to test if 12 bars has passed since the trade launch is:

    test = barindex-tradeindex >=12
    
    if test then 
     //do something here
    endif
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

how to temporarily stop auto trading?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ccskycc101 @ccskycc101 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Nicolas
8 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/18/2017
Status: Active
Attachments: No files
Logo Logo
Loading...