Trading System Germany 30

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #36539 quote
    HenryHenry
    Participant
    Average

    A request that was addressed to ProRealTime:

    Germany 30
    TF – 10 hours

    So I have this code below which only enters long trades and it opens multiple positions.

    what I would like it to do is…open long positions exactly as it does, but not multiple positions. Also when it exits a long position I’d like it to open a short position at the same time and the next long position to close that short position and so on,

    thanks

    Suggestion for an answer:

    DEFPARAM cumulateorders = false
     
    TIMEWORK = 070000
    TIMESTOP = 210000
    acc = 5
     
    if justone = 0 then
    capital = 10000 * pointvalue
    justone = 1
    endif
     
    perccap = 0.5
    margin = 0.5 * close * pointvalue / 100
    period=5
    stdev=STD[period](close)
    //LOOK FOR A LOCAL VOLATILITY DECREASE
    //I WANT TO BUY AGAIN ONLY WHEN BEAR MARKET SHOWS A LOCAL PAUSE
    if (stdev[0]+stdev[1]+stdev[2]+stdev[3]+stdev[4]) < (stdev[1]+stdev[2]+stdev[3]+stdev[4]+stdev[5]) then
    SWBUY=1
    else
    SWBUY=0
    ENDIF
     
    IF TIME > TIMEWORK AND TIME < TIMESTOP THEN
    if not onmarket then
    sizebuy = ROUND((capital *perccap /100)/ margin)
    tp = 0.25
    IF CLOSE < CLOSE[1] THEN
    BUY sizebuy SHARES AT MARKET
    endif
    endif
     
    if Onmarket then
    if longonmarket then
    perf = (close - POSITIONPRICE)/POSITIONPRICE * 100
    else
    perf = (POSITIONPRICE - close)/POSITIONPRICE * 100
    endif
    if perf > tp then
    SELlshort AT MARKET
    perfc = (close - POSITIONPRICE) * POINTVALUE * COUNTOFPOSITION
    capital = capital + PERFC
    ELSE
    IF LASTBARBUY = 0 THEN
    if (((CLOSE-TRADEPRICE)/TRADEPRICE)*100) > acc AND SWBUY=1 then
    sizebuy = ROUND((capital *perccap /100)/ margin)
    BUY sizebuy SHARES AT MARKET
    LASTBARBUY = 1
    ENDIF
    ELSE
    LASTBARBUY = 0
    ENDIF
    ENDIF
    ENDIF
    ENDIF
Viewing 1 post (of 1 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

Trading System Germany 30


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Henry @henry Participant
Summary

This topic contains 1 voice and has 0 replies.

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