No Backtesting results

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #224219 quote
    crankbuddy
    Participant
    New

    I have been using back testing for quite a while, I’ve just changed a strategy and now I get no results even when I change the code to be very simple. not sure what’s wrong here . AUD/USD mini

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Buy Price
    Startprice = Tradeprice
    TakeProfit = (Startprice + 0.0008)
    Buyit = 1
    
    // Conditions to enter long positions
    indicator1 = MACDline[12,26,9](close)
    indicator3 = MACD[12,26,9](close)
    indicator4 = Average[18](close)
    indicator5 = MACDSignal[12,26,9](close)
    
    c1 = (indicator1 > indicator1[1])
    c2 = (indicator1 > indicator3)
    c3 = (close > indicator4)
    c7 = (indicator1 > indicator5)
    
    IF c1 and c2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator6 = (close > Takeprofit)
    
    c4 = (indicator1 < indicator1[1])
    c5 = (close > Startprice)
    c6 = indicator6
    
    IF c4 or c6 THEN
    SELL AT MARKET
    ENDIF
    
    1.png 1.png
    #224223 quote
    GraHal
    Participant
    Master

    As it’s on Forex, Line 6 needs to be as below … assuming you even mean that as 0.0008 ia a very small increase??

    TakeProfit = (Startprice + 0.0008*pointsize)
    #224224 quote
    crankbuddy
    Participant
    New

    Thanks GraHal this has worked as well as a variable in the past but I’ll give it a try. but this is more about taking the trade not closing the position .. I’m struggling to even start a trade .. thank you ..

    #224225 quote
    GraHal
    Participant
    Master

    Use below at bottom of your code so you can see when C1 and c2 are true to check for coincidence.

    MyBuy - C1 AND C2
    GRAPH MyBuy
    #224231 quote
    GraHal
    Participant
    Master

    Typo in above, should as below …

    MyBuy = C1 AND C2
    GRAPH MyBuy
    crankbuddy thanked this post
    #224252 quote
    JS
    Participant
    Senior

    Hi @crankbuddy

    There is an error in the code, namely line 29 “c6=indicator6″…

    This condition is always true, so the position is immediately closed again…

    Remove line 29 and change line 31 to “If c4 then”

    GraHal and crankbuddy thanked this post
    #224275 quote
    crankbuddy
    Participant
    New
    Thanks JS, I removed the code and it fixed the problem, and Thanks GraHal for the GRAPH tip, it’s handy and I will use it in future coding.
    JS and GraHal thanked this post
    1-1.png 1-1.png
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

No Backtesting results


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
crankbuddy @crankbuddy Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by crankbuddy
2 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/24/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...