defining variables each morning

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41126 quote
    tavtav
    Participant
    Junior

    How do I define a variable in the morning before trading?

    I would like variable traded=0 each morning until a trade has occured then traded=1 for rest of trading day.

    #41133 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You must first decide what is your trading time.

    Example if you only want to have the variable “traded” set between 10:00:00 and 19:00:00, each day (of course this won’t work in a Daily, or greater,  timeframe):

    ONCE StartTime = 100000
    ONCE EndTime   = 190000
    ONCE Traded    = 0
    IF (time < StartTime) OR (time > EndTime) THEN
       Traded = 0
    ELSE
       Traded = 1
    ENDIF
    

    Roberto

    #41192 quote
    tavtav
    Participant
    Junior

    ok thank you. I have it as you have shown it but I want trade=1 when another condition is fulfilled ie when a trade has happened. The problem I’m facing is traded randomly sets to 1 just before the condition is fulfilled usuallyjsut before DEFPARAM FlatBefore = 080500. |Does DEFPARAM FlatBefore  affect variable initialisation?

    #41245 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    DEFPARAM FlatBefore does not affect variables, it affects conditions, though, because trades will not be triggered even if all conditions are met (but variables still retain their values as set at each new bar).

    To combine other conditions you may add them as follows:

    ONCE StartTime = 100000
    ONCE EndTime   = 190000
    ONCE Traded    = 0
    IF (time < StartTime) OR (time > EndTime) THEN
       Traded = 0
    ELSEIF (conditions) THEN                 // you may add other conditions here
       Traded = 1
    ENDIF
    #41332 quote
    tavtav
    Participant
    Junior

    thank you

Viewing 5 posts - 1 through 5 (of 5 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

defining variables each morning


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
tav @tavaziva_madzinga Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/20/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...