IF market has a big move

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5774 quote
    mikael
    Participant
    Average

    Hi!

    Dose anyone now how to code: IF the instrument you trade goes up 5% one day then dont take trades the day after.

    I would be grateful for any help 🙂

    #5780 quote
    Nicolas
    Keymaster
    Master

    Hello mikael,

    That’s pretty easy. First look for the variation from yesterday:

    var = 100-(DCLOSE(1) / DCLOSE(2))*100

    Then test the “var” variable if it’s superior to your threshold (5% here), if so, then define the variable “allowtrade” to 0:

    if ABS(var)>5 then
     allowtrade = 0
    else
     allowtrade = 1
    endif

    Then you can test this variable in your order launch conditions (example):

    IF buycondition AND allowtrade=1 THEN 
     BUY 1 SHARE AT MARKET 
    ENDIF 
    

    Tell me if it does the trick! 🙂

    #5827 quote
    mikael
    Participant
    Average

    Thanks! It works :). I had thought about something like that but I couldn’t put it together.

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

IF market has a big move


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
mikael @mikael Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by mikael
9 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/22/2016
Status: Active
Attachments: No files
Logo Logo
Loading...