IF market has a big move

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5774 quote
    mikaelmikael
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    mikaelmikael
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 mikaelmikael
10 years, 5 months ago.

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