code inside bar-trade

Forums ProRealTime English forum ProOrder support code inside bar-trade

Viewing 8 posts - 1 through 8 (of 8 total)
  • #224779

    Hello.

    I am trying to code a trading system based on inside bar. I have created an own indicator that gives 1 when an inside bar appears within my margins. With this code it is only taking trades for the upside. If the inside-bar indicator gives 1 i want to set an stop order att the high of the mother-bar and a stoploss at the low of the mother-bar.

    Question 1

    When i probacktest, it is not taking a trade every time, only sometimes. And i dont understand why?

    Question 2

    If i want it to make pending-orders both at the uppside and downside until one will be activated, can i do it with two tradingsystems? I guess i just can put one order at once in one trading-system.

    #224781

     

    #224795

    You should port the indicator as well, to be able to test the code.

    In line 15, you are using a STOP order which means that the current price is LOWER than the entry price, is that always the case?

     

    #224906

    as it is an inside bar trade, the daughter bar must be lower than the mother bar that sets the stop order level and then the price is always below my stop order. But you are right, a gap can appear between bars. I could enter that stop order is placed for example 1 pips above the mother bar high to cover this. Do you have any better suggestions?

    #224907

     

    #224908

    i forgot to say i am trying to get it working on EUR/USD 5 min chart

    #224910
    JS

    Hi @kimmen

    Try this one:

     

    2 users thanked author for this post.
    #224989

    Thanks for the help. Now it works much better. However, I don’t understand why it sometimes skips trades. For example as in the picture I am attaching, EUR/USD 5 min chart, 2023-12-07 at 09:30 and 10:25. The indicator shows 1 but it only trades on the first opportunity and skips the second.

    The changes you made that I can see is that you removed pendingorder=0 in my first if statement where I wrote: If indicatoractive=1 and pendingorder=0 and not ONMARKET then pending order=1.  Now it works better, but this probably means that pipsLoose,Entry,Loose,pipsGain changes every bar when the indicator is active until the price passes the stop order and a deal is made. Or is  “onmarket” counted already when the stop order is placed on the market? The indicator can show 1 for several bars but I want the pipsLoose,Entry,Loose,pipsGain levels to be set only after the first time. How can i fix this issue?

    thanks again for the help

Viewing 8 posts - 1 through 8 (of 8 total)

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