Trade closes automatically

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #41961 quote
    Pjotterd
    Participant
    Average

    Hi guys,

    First of all, a big thumbs up for this forum. You guys really help me out.
    I’ve got a question:

    I have backtested a strategy for gold and it works quite well. There is only one thing I want to change. While backtesting PRT automatically closes a trade because a new trade is activated by the strategy. I actually don’t want this trade to be closed automatically. My question is, does this also happen when I’m trading for real? And if so, what would be the solution to fix this problem?

    Thanks again guys
    BR Pieter

    #41964 quote
    JC_Bywan
    Moderator
    Master

    Hi, assuming you talk about trade closed not just by any other trade but only by new trade in opposite direction, then this recent topic should explain and provide with code keyword to avoid it (not the “time” 1st part of topic but a bit firther towards the end the “if not onmarket and…” or “longonmarket”/”shortonmarket” parts of it)

    https://www.prorealcode.com/topic/help-for-a-newby-time-specific-actions/

    #41988 quote
    Pjotterd
    Participant
    Average

    I’m sorry, but I still don’t understand what I have to do to fix this. Yes, it is about the trade that is not closed  just by any other trade but only by new trade in opposite direction. Can you help me out here?

    #41996 quote
    JC_Bywan
    Moderator
    Master

    Don’t know what more I could say than post #41666 () extracted from link I gave above, so I’ll copy it below in case link didn’t work:

    === === #41666 ===

    “onmarket” should be the useful keyword to avoid “take and reverse” when you want the existing trade to go all the way not stopped prematurely by opposite entry conditions being met (p.17 https://www.prorealtime.com/en/pdf/probacktest.pdf )

    Would use it by adding the condition “if not onmarket” to your existing entry conditions, so that it considers a new entry only if onmarket=0, then it shouldn’t open any opposite direction trade while there’s one still ongoing

    if not onmarket and [add here your long order entry conditions] then
      buy etc...
    
    if not onmarket and [add here your short order entry conditions] then
      sellshort etc...
    #42000 quote
    Pjotterd
    Participant
    Average

    Thanks again. But That’s the problem. I want the first trade to go all the way. And meanwhile I want the second trade (in the other direction) to open as Well. 

    #42002 quote
    JC_Bywan
    Moderator
    Master

    Ok, if the problem is not so much the first one closing but having both trades in opposite direction at the same time, that’s not possible, PRT won’t let you have trades in opposite directions inside same strategy as far as I know, no coding could go around that. I am not aware of the possibility of this being looked at for next version with new PRT engine, but maybe Nicolas would correct me if there was news on that front.

    #42003 quote
    JC_Bywan
    Moderator
    Master

    However, if you don’t have a new limited risk account, 2 separate strategies running at the same time on same instrument (one for long, one for short) might do… but not inside a single strategy

    #42004 quote
    Pjotterd
    Participant
    Average

    Ok, tanks a lot noobywan

    #42005 quote
    Pjotterd
    Participant
    Average

    I actually think I have found a Solution. I Will split my system in two Systems. One to go long and one to sell short. Problem solved 🙂

    #42007 quote
    JC_Bywan
    Moderator
    Master

    Was wondering if you saw my 10:37 as we posted together at the same time (happened to me before, missing a reply when the person posted twice in short time and I don’t see there’s a new message between the one I reply to and mine) .

    I would insist though, this double strategy would work only if you have the old “unlimited risk” cfd account type, not the new “limited risk” cfd account for some countries with recent legislative changes for cfd from what I’ve read (I have an old one, haven’t tested changes first-hand with new one).

    https://www.prorealcode.com/topic/trading-automatique-sur-compte-a-risque-limite-et-proorder/

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Trade closes automatically


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Pjotterd @pjotterd Participant
Summary

This topic contains 9 replies,
has 2 voices, and was last updated by JC_Bywan
8 years, 7 months ago.

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