premarket open price breakout strategy idea

Forums ProRealTime English forum ProOrder support premarket open price breakout strategy idea

Viewing 15 posts - 16 through 30 (of 38 total)
  • #67783

    Thanks again Roberto and all For the last few days I wrote the basic test code but it is still not finished.

    1. I am still not sure how to cancel all positions and orders – is there a command (like QUIT but only for a single day) or do I need to manually SELL AT MARKET even when I didn’t buy yet
      Pending orders expire when each bar closes, so you don’t need to do anything to cancel them, on the contrary you’ll have to place them again if you still want them to be pending for one more bar/candle.
      There is no temporary QUIT, if you QUIT a strategy then you’ll have to restart it manually.
      To close all open trades you’ll have to place a SELL order for Longs and EXITSHORT for Shorts.
      No partial closing is allowed, when you exit a trade ALL contracts will be closed.
    2. I am also not sure if all the code is run for each bar again and again (I am guessing the answer is yes)
      Yes, you are right, it wouldn’t be automated trading otrherwise.
    3. if the bar is a 3 minute bar does it wait till close to run the code is it not in “real time” tick for tick
      Right again, as of this version of the platform, any strategy is run every time a candle/bar closes, just before the new one is opened.
    4. if I want to look back and backtest the data from the last 12 month can I do it on a 3 min bar? it seems I have very limited access to the data on a 3 min bar
      You can do it on any bar you want, but a 3-minute bar is a multiple of a 1-minute bar which, with 100k historic data, allows only a bit more than 3 months of backtesting.

    Any help would be greatly appreciated Thanks Alan

     

    1 user thanked author for this post.
    #69614

    Getting back to ProRealCode after a few weeks away…

    Thanks for the answers. that makes more sense now.

    I have a few  quick questions:

    1. I see that adding or removing the “GRAPH” command causes the algorithm not to work or changes the results sometimes. any possible reason for that? is it a bug or am I missing something
    2. Does the location of the GRAPH command matter to the results? if I place a GRAPH X inside an IF statement would I get different results from outside the if statement for example
    3. Is StrategyProfit for each specific strategy? if I run 2 separate strategies will this parameter be changed? if I run manually trading and automatic trading will this parameter be altered

    Thanks again,

    A.

    #69616

    Getting back to ProRealCode after a few weeks away…

    Thanks for the answers. that makes more sense now.

    I have a few quick questions:

    1. I see that adding or removing the “GRAPH” command causes the algorithm not to work or changes the results sometimes. any possible reason for that? is it a bug or am I missing something
    2. Does the location of the GRAPH command matter to the results? if I place a GRAPH X inside an IF statement would I get different results from outside the if statement for example
    3. Is StrategyProfit for each specific strategy? if I run 2 separate strategies will this parameter be changed? if I run manually trading and automatic trading will this parameter be altered

    Thanks again,

    A.

    1. I never experienced that, I assume it doesn’t affect strategies, it only may affect the VARIABLES window, if you exeperienced this issue you should post the whole code in order to replicate it.

    2. Wherever you place GRAPH will never affect your strategies, but for sure the output on the screen will change if the code between the two GRAPH locations modifies the value of GRAPHed data. I just tried putting GRAPH in an IF statement and it ALWAYS displays the same value retained when the condition was last true.

    3. STRATEGYPROFIT returns data relative to a single strategy; manual trades won’t affect automated strategies, unless you manually close/modify automated trades.

     

    1 user thanked author for this post.
    #70062

    Thanks again.

    Here is the skeleton of my code. I need a way to see were the program is at every stage (I am used to debugging and tools, system printouts, IDE etc…)
    I created a state parameter and tried to set different values to it based on the position it is in, but the state stays 0 all the time.

    What am I doing wrong here? how can I quickly debug my code?

     

    #70065

    Line 21 can be replaced by ELSE and, if you do, line 23 must be commented out.

    Apart from these details (not affecting the value of variable STATE), I can only recap all your conditions as follows

    STATE values:

    0   = initial
    1    = when FirstHour is true, but will be immediately overridden by one of the following conditions (OnMarket or Not OnMarket)
    2   = when OnMarket is true, but will be immediately overridden by the following two conditions (Long/ShortOnMarket)
    3   = LongOnMarket
    4   = ShortOnMarket
    5   = Not OnMarket AND all of the following conditions (from ELSE through the last ENDIF) are FALSE
    6   = Not OnMarket AND EnableTrade = 0
    7   = Not OnMarket AND EnableTrade = 1 AND there was a Loss OR outside trading Hours
    8   = Not OnMarket AND EnableTrade = 1 AND all the following conditions (from there through ENDIF before the last ELSIF) are false
    9   = Not OnMarket AND EnableTrade = 1 AND both LongTriggered & ShortTriggered are TRUE
    10 = Not OnMarket AND EnableTrade = 1 AND LongTriggered is TRUE
    11 = Not OnMarket AND EnableTrade = 1 AND ShortTriggered is TRUE
    12 = Not OnMarket AND EnableTrade = 1 AND no change in Equity

    This is all I coud do without the full code, check if they are what you really wanted to happen within your strategy.
    1 user thanked author for this post.
    #70069

    Thanks Roberto for the quick reply.

    Yes, the conditions are correct.

    I managed to fix this problem by changing the time frame to 10 seconds instead of 1 min. That way it triggered correctly.

    This causes another issue. I want to test the code on different dates and with 10 seconds I can only get today.

    Changing the date frames (for example 5/3/18-6/3/18) in the date period on the right hand side of the proBackTest resulted in an error: “Please check your start and end date”

    is there any way of backtesting with this short time frame?

    BTW, I did see instances when adding a graph command removed the trading for that day and then removing it and re-adding it or changing it to “ONCE” made it work again…
    could be a bug and I can PM  the code if you like.

     

    #70071

    Also, before I go fully live, a general question.

    How can I test this with small amounts say 1$ per point for a few days?

    How much is 1 contract considered?

    Thanks again for all the help and support!

    #70075

    ONCE is used to initialize a constant or a variable (PRT makes no difference between the two).

    GRAPH is used to show the contents of constants/variables for debugging purposes only.

    As for the time range when backtesting, there’s no limit; I used sometimes to shrink it to a couple of hours. That error message occurs once in a while, I usually close the running strategy and all backtest so far and open it again to restart and it always worked. On a worst case you could try to close PRT and restart it all over.

    On a 10-second TF I have one week of data to backtest.

     

    1 user thanked author for this post.
    #70094

    Thanks again,

    I did restart the whole program but the message persists.

    so my questions are:

    1. Is it possible to ask for a time frame in the past like 1.5.18 at 15:00 till 2.5.18 till 15:00 – and if so is there a support team to be contacted in case it does not work?
    2. I am shown only 1 day for 10sec frames. I can only choose 10,000 units so I was guessing that is the limit. are there any other options?
    3. How much money is “1 contract” considered? (I am used to manually typing the amount in PPT (pounds per point)

    Thanks again

    #70101
    1. It is possible to select the TFs you mentioned, in case you need assistance you may either type CTRL+M or click the help menu on the bar and select the assistance form (I don’t know the english name they assigned to that menu item);
    2. I have 100,000 units and I can backtest roughly one week, this is the limit for demo accounts (with my IG real account I have 200,000 units available);
    3. PRT (at least with IG accounts) makes 3 types of contracts available to trade DAX, normal (€ 250,000), mini (€ 50,000) and micro (€ 10,000) so that a single pip may have a value of € 25, 5 or 1; for major FX pairs they offer normal contracts (100,000 units of the involved currency) or mini contracts (10,000 units), so pips may have a value of 10 or 1 unit.

     

    1 user thanked author for this post.
    #70113

    Thanks again, got it and will fill the help form.

    Today I added another short script. It is very basic:
    At the end of every daily bar exit all active positions and set new buy and sell orders with stoploss and limit
    It works fine, but in the cases where for example the buy stoploss is activated and the sell should be triggered it reacts weird.
    It shows me on the graph as if it created 2 orders but the profit is off and the equity curve gets hit as if the strategy lost thousands. that doesn’t make sense
    I can’t debug it since I am using daily bars and can’t look into each sell/buy separately.

    Is the sell stoploss value maintained even after a buy was triggered and stopped? I am guessing that could be the problem

    I think I can easily fix it with hourly bars but that seems like a complicated solution to a simple task which is why I want to verify I haven’t missed something here

     

     

    #70119

    Yes, that’s the issue. ProOrder takes control of operations when a bar closes to run a strategy, after that control is released to the broker, who is not aware of that strategy, so if there are two pendin orders sometimes they may be entered within the same bar, no matter what DEFPARAM CumulateOrders says.

    This will change with the incoming MTF (Multi Time Frame) version, since your strategy will be able to setup any trade according to greater TFs but execute orders on a very low TF, even a second.

    The main drawback is that you will need to launch the strategy from within the lower TF (say 1 second) so I’m afraid backtesting will be limited to a few days instead of years of data history available for the daily TF. This is a question I asked Nicolas this morning in another topic. I’m eager to know his answer!

     

    1 user thanked author for this post.
    #70120

    Is it possible to ask for a time frame in the past like 1.5.18 at 15:00 till 2.5.18 till 15:00 – and if so is there a support team to be contacted in case it does not work?

    I am shown only 1 day for 10sec frames. I can only choose 10,000 units so I was guessing that is the limit. are there any other options?

    How much money is “1 contract” considered? (I am used to manually typing the amount in PPT (pounds per point)

    See attached re 1 and 2.

    Re 3 1 Contract is always £1 per point in UK with IG when spreadbetting.

     

    2 users thanked author for this post.
    #70166

    Ok, Thanks

    So until MTF comes out, how can I ask:

    “give me the high (or low) of previous day” on a time frame of 3 min for example.

    when I use :

    high = highest[480](high)

    it will not work on some days as there aren’t 480 bars per day I guess and it will definitely not work after a weekend – so I am getting results that differ from the actual high and low of the day

    #70167

    Thanks

    I am familiar with 2 of the screens for the timeframe (but for some reason it gives me an error when I try and set the dates there)

    Thanks for the reply for question 3

Viewing 15 posts - 16 through 30 (of 38 total)

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