Selling at a STD in a downtrend

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #175830 quote
    marie123marie123
    Participant
    Junior

    Hello guys,

    I used to code the ProScreener only and this is my first try to code the ProBuilder.

    A very simple idea: I want to sell a stock if it is in a downtrend and touches the SMA20+3*STD. The stop loss should be SMA20+4*STD and the take profit is the SMA20.
    Seems to be simple but I have problems with the syntax and would be very thankful for any help.

    entry=average[20](close)+3*std[20](close)
    stoploss=average[20](close)+4*std[20](close)
    takeprofit=average[20](close)
    downtrend=close<average[50](close) and average[50](close)<average[200](close)
    
    if downtrend then
    if high>entry then
    sell 100 shares at market
    set stop loss stoploss
    set target profit takeprofit
    endif
    endif
    #175832 quote
    GraHalGraHal
    Participant
    Master

    Try SellShort (instead of Sell).

    Sell is only used if are already Long.

    marie123 thanked this post
    #175836 quote
    marie123marie123
    Participant
    Junior

    It works, thank you very much.

    Is is somehow possible to get a report from all trades or is it just visually in the chart possible to analyze the backtests?

    #175837 quote
    nonethelessnonetheless
    Participant
    Master

    it should automatically deliver a report, but if not then left click on “ProBacktest – Equity curve:” and select Detailed Report

    you can customise the report for what details you want to see.

    marie123 thanked this post
Viewing 4 posts - 1 through 4 (of 4 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

Selling at a STD in a downtrend


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
marie123 @marie123 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by nonethelessnonetheless
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/21/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...