saving tradeprice when meet conditions

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #161868 quote
    kevin12345kevin12345
    Participant
    Average

    hi,

    anyone know if i can save tradeprices when it meets my conditions. For example,

    conditions = ………

    if conditions then

    ‘(save tradeprice) ”

    endif

    thank you

    #161872 quote
    kevin12345kevin12345
    Participant
    Average

    hi,

    i have gotten something at the moment but it seems to half work. see picture. the red tick is the correct one i am going for but after that there is 3 red crosses which is not what i what the codes to do because it does not meet my uptrend, c1 , macup , and habullcandle15 conditions. here are my codes.

    n=0
    var = highest[10](close)
    IF uptrend and c1 and macup and habullcandle15 and not longonmarket then
    n= n+1
    var = var[n]
    ENDIF
    if(haclose15 > var[n]+0.0003) and habearcandle15 then
    n=n-1
    endif
    if (var[n]- close >0.0030) then
    sellshort 2 contracts at market
    endif
    if shortonmarket and (((haclose15 +0.0003< positionprice ) and habullcandle15) or (tradeprice - close>=0.0030)) then
    exitshort at market
    endif
    SET STOP pLOSS 30
    Capture-6.png Capture-6.png
    #161884 quote
    NicolasNicolas
    Keymaster
    Legend

    You are triggering an order because of condition at line 10, so I suggest you GRAPH var[n] to see when, how and why it updates its value. I think the problem is located in this variable value.

    #161892 quote
    kevin12345kevin12345
    Participant
    Average

    my var[n] is changing. any ideas how i can fix it?

    #161901 quote
    kevin12345kevin12345
    Participant
    Average

    how do i find the barindex if line 3 satisfy?

    #161912 quote
    NicolasNicolas
    Keymaster
    Legend

    Sorry i’d like to help, but I don’t understand what is the strategy? Your code is obscure to me… 🙂

    To save the tradeprice into a variable, just do this:

    lasttradeprice=tradeprice
Viewing 6 posts - 1 through 6 (of 6 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

saving tradeprice when meet conditions


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kevin12345 @kevin12345 Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by NicolasNicolas
5 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/18/2021
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...