Translation of EasyLanguage code

Viewing 15 posts - 16 through 30 (of 30 total)
  • Author
    Posts
  • #78682 quote
    Vonasi
    Moderator
    Master

    I think that if you are going to use TP and SL levels on an index such as the DJI then it is much better to set them with a percentage rather than a fixed pip amount because as the DJI price increases over time so does the average range of each candle so you are far more likely to stay in tune with the market as it moves forward.

    As ever I am sceptical of the 5 minute time frame due to the lack of backtest data available. I only have 100k bars so let’s hope someone with 200k can come along and give us an OOS test.

    #78683 quote
    GraHal
    Participant
    Master

    much better to set them with a percentage rather than a fixed pip amount

    Thanks, I agree with the logic, but I have more of a memory / feel for fixed pips that I am happy with for the various TF’s (from manual trading I guess).

    If I were running Live with a System I would  hope I’d periodically reassess; I’m sure I’d be watching it like a hawk!!! 🙂

    #78687 quote
    GraHal
    Participant
    Master

    As ever I am sceptical of the 5 minute time frame

    Well you’re going to hate this one then! 🙂 🙂

    I’ve got 4 versions on Demo Fwd Test now!

    Multi TF on this version and max Lot size of 2.

    //-------------------------------------------------------------------------
    // Main code : Mags/Nic BO DJI 5M v1.1
    //-------------------------------------------------------------------------
    //https://www.prorealcode.com/topic/translation-of-easylanguage-code/
    
    defparam cumulateorders=false
    //Main Timeframe: 15-minute (EXCHANGE TIME)
Second Timeframe: DAILY

    //{Strategy inputs}
    //inputs:
    Timeframe (5 mn, updateonclose)
    myFraction=4.7
    N1higher=10
    N2higher=16
    N1main=4
    EntryCond1long=1 //(0=false ; 1=true)
    EntryCond2long=1 //(0=false ; 1=true)
     
    //{StopLoss}
    //Input:
    
     
    if onmarket then
    alreadytraded=1
    endif
    if intradaybarindex=0 then
    alreadytraded=0
    endif
     
    //Point Of Initiation
    TodaysOpen = DOpen(0)
     
    //For the calculation of the space
    ATR = AverageTrueRange[40]
     
    //The BreakoutLevel (POI + space)
    myBreakoutLong = TodaysOpen + ( myFraction * ATR )
     
    //higher timeframe filter condition (DAILY)
    EntryCond1long = 0.1 * (Dclose(0) - DHigh(N1higher)) < N2higher
     
    //main timeframe filter condition (15 minute)
    EntryCond2long = dClose(1) - Lowest[N1main](high) < ATR
     
    //Position size condition
    if dclose(1) < dopen(1) then
    value1 = 2
    Else
    Value1 = 2
    endif
    //Entry Condition

    if not onmarket and EntryCond1long and EntryCond2long  and not alreadytraded then
    buy value1 contracts at myBreakoutLong stop
    endif
    //Exit Condition

    
    Timeframe (1 mn)
    If Stochastic[14,3](close) crosses under 90  Then
    Sell at Market
    endif
    
    SET TARGET PPROFIT 90
    set stop ploss 90
    
    Nicolas thanked this post
    Mags-3.jpg Mags-3.jpg Mags-4.jpg Mags-4.jpg
    #78693 quote
    Vonasi
    Moderator
    Master

    Well you’re going to hate this one then!

    1 minute time frame = 25 x more sceptical than 5 minute time frame!

    #78740 quote
    GraHal
    Participant
    Master

    Anybody any ideas what may be causing the error message attached for the code 2 posts up.

    https://www.prorealcode.com/topic/translation-of-easylanguage-code/page/2/#post-78687

    Below is the only addition to a version of the code which is running fine, so the error message seems not to make sense??

    Timeframe (1 mn)
    If Stochastic[14,3](close) crosses under 90  Then
    Sell at Market
    endif

    Edit / PS

    I just noticed I’d set it going on 5 min TF and it should be 1 min, corrected now, but I’ll leave the post up as the error message seems a weird anyway and may be relevant re MTF beta testing etc.

    Mags-5.jpg Mags-5.jpg
    #78743 quote
    GraHal
    Participant
    Master

    Edit / PS I just noticed I’d set it going on 5 min TF and it should be 1 min, corrected now, but I’ll leave the post up as the error message seems a weird anyway and may be relevant re MTF beta testing etc.

    Coffee hadn’t worked thro’ … v2.1 was running on 1 min TF after all!

    It had 5M in the System name that’s where I was confusing myself! 🙂

    So the weird error message (see post above) still stands as a query if any ideas from anybody please??

    Edit / PS

    Also the rejection occurred 2 or 3 times per second over a 10 second period (see attached to above post).

    #78745 quote
    Vonasi
    Moderator
    Master

    That just looks like the order has been rejected because the strategy is trying to place it on the market at a price that has already been passed. There is only one pending order in the code on line 52 so the calculated value of myBreakoutLong must be wrong sometimes. Try graphing it and the close price and see what values you get.

    GraHal thanked this post
    #78748 quote
    GraHal
    Participant
    Master

    Spot on Vonasi!

    Thank you and a double thank you for thinking even while 25 x sceptical! 🙂

    First image is at time of error message (price below myBreakoutLong)  and second image is a successfull trade being placed (price above myBreakoutLong).

    Any ideas for a fix (or anyone else) please?  (Full code is 6 posts above)

    Mags-6.jpg Mags-6.jpg Mags-7.jpg Mags-7.jpg
    #78753 quote
    Vonasi
    Moderator
    Master

    You could just put in an extra condition that means you only try to place an order if myBreakoutLong is greater than close. That way you will not get any rejected orders.

    You could also try just buying at market if myBreakoutLong is lower than close – or set a LIMIT order if it is lower and a STOP order if it is higher.

    I’ve not looked at the strategy details so not sure how the above would change results.

    #78754 quote
    GraHal
    Participant
    Master

    Deleted as was same as you suggested

    #78756 quote
    Vonasi
    Moderator
    Master

    A buy STOP order is one to buy at a worse price than the current one so you would need to only place the order if myBreakoutLong is higher (a worse price to buy) than close. So you need:

    c1 = myBreakoutLong > close

    Edit: You edited your post again!

    #78757 quote
    GraHal
    Participant
    Master

    Edit: You edited your post again!

    Yes I know, sorry! Thanks for clarification!

    I realised I had it wrong as only half my brain is on this, but I’m also trying to order scaffolding for my daughters extension! 🙂

    #78761 quote
    GraHal
    Participant
    Master

    c1 = myBreakoutLong > close

    What is confusing me though is that when the System got rejected with the weird error message then  myBreakoutLong > close.

    I guess my screen shot below is a red herring ?

    Mags-6-1.jpg Mags-6-1.jpg
    #78766 quote
    GraHal
    Participant
    Master

    I’ve got it now … all conditions are met at close of bar (including myBreakoutLong > close) and then if the pending order – stop level (mybreakoutLong)  – is met in the next bar then a trade is executed.

    Still don’t understand exactly why I got the original error message though?

    #78770 quote
    Vonasi
    Moderator
    Master

    but I’m also trying to order scaffolding for my daughters extension!

    That’s nice that you are having your daughter extended!

    GraHal thanked this post
Viewing 15 posts - 16 through 30 (of 30 total)
  • You must be logged in to reply to this topic.

Translation of EasyLanguage code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mags67 @mags67 Participant
Summary

This topic contains 29 replies,
has 4 voices, and was last updated by Vonasi
7 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/14/2018
Status: Active
Attachments: 11 files
Logo Logo
Loading...