Make a trade on each candle

Forums ProRealTime English forum ProOrder support Make a trade on each candle

Viewing 15 posts - 1 through 15 (of 19 total)
  • #154931

    I want to open and close a trade on each candle.

    With “IF on  market Then sell at market” it only trades every second candle.

    Is there another way?  Tried MTF but it would only trade longs or shorts! Not both.

    Any help gratefully appreciated.

     

    #154935

    There you go:

     

    #154943

    Basically Roberto’s code will open a trade on the first candle and then after that every BUY order will be cancelled by a SELL order so you will just stay on the market forever!

    Do you mean that you want a position to be opened at start of a candle if conditions are met and then closed mid candle or at the close of the candle if not closed mid candle?

    You mention long and short. It is not possible to be both long and short at the same time in an auto strategy.

    #155054

    I still cannot get this to work. Started with a new code.  See attachment “MySystem19”. This traded every candle.

    Then I put in “my conditions” and copied and pasted the closing arguments from MySystem19 (see attachment “MySystems21″)

    My conditions is 200ma <> previous candle.

    When I ran it, it does not trade the next candle even if the conditions are met. (see attachment” 877 screen copy”)

    It should trade every candle!

    Can you please help me work out what I am doing wrong?

    Thanks in advance.

    #155061

    If the code is not massive then you are better to use the ‘Insert PRT Code’ button and post the strategy code directly in your post. Just attaching an ITF file means that someone who wants to help you has to download a file, open their platform, import a file, guess which instrument and time frame you are applying it to and then finally look at the code to see where the error is. This is even less likely to happen if the markets are closed and no one has their platform open! 🙂

    Inserting the code in your post will get far more eyes on it far sooner.

    #155062

     

    My apologies Vonasi. I had been corrected by the moderator to attach the code as it was more readable.

    But I am aware of the different level, and I can understand where you are coming from.

    I will add the codes below

    Here is the first code that trades every candle-

     

    Here is the second code, with conditions, that only trades every other candle – see screenshot

     

     

    #155066

    This will enter every other candle:

    This will enter each candle:

     

    #155069

    Code in text format.

     

    MySystem19. This trades every candle

     

    MySystem21. This one only trades every candle.

    How do I make this trade every candle?

     

     

    #155070

    CORRECTION:    MySystem21 only trades every other candle.

    #155072

    This code will open/close each candle, provided conditions are different each candle:

    because when conditions are different it always enters doing Stop & Reverse, while if conditions aree the sane as the previous candle:

    • if CumulateOrders = FALSE then it can’t open another trade in the same direction, because it needs one candle before it knows the trade had been closed a few lines above
    • if CumulateOrders = TRUE  then it will accumulate positions in the same direction.

    To recap, you can open/close a trade every candle only by doing Stop & Reverse, that is when conditions are different from the previous candle.

     

     

    #155075

    Still not working. There are different conditions to Buy & Sell – 200ma < or > previous candle.

    1.Have set cumulating positions to True.

    2. Closed any open positions.

    The code is still only trading every other candle even when the conditions are true.

    See attachment.

     

     

    Latest code:

     

     

    #155090

    You’ve been posting several code snippets without using the Insert PRT Code’ button, please respect the rules as highlighted below in yellow.

    As I explained, if conditions are the same direction as the previous candle a trade cannot be opened the following candle.

    There’s no workaround. You either change your conditions so that they always imply doing a Stop & Reverse each candle or change your strategy.

     

     

    1 user thanked author for this post.
    #155097

    I tidied it all up!

    trevor – see the attached image for the location of the ‘Insert PRT Code’ button as you seem to be having a lot of difficulty finding it! 🙂

    #155099

    You’ve been posting several code snippets without using the ‘Insert PRT Code’ button, please respect the rules as highlighted below in yellow.

    Wow. Did it maybe occur to you that you refer to a button which you know but others may not ?

     

     

    1 user thanked author for this post.
    #155101

    Wow. Did it maybe occur to you that you refer to a button which you know but others may not ?

    We assume that everyone is aware that the tools available for editing your posts can be found in the tool box attached to the box where you are typing. Perhaps we make too much of an assumption regarding everyone’s abilities.

    The button in your image is not the correct one. That is for posting to the library. See the image in my previous post for the correct button. 🙂

    1 user thanked author for this post.
Viewing 15 posts - 1 through 15 (of 19 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login