entry price long above close of pinbar

Forums ProRealTime English forum ProOrder support entry price long above close of pinbar

Viewing 12 posts - 1 through 12 (of 12 total)
  • #219326

    Hello,

    I would like some help with the following. I created an indicator which is looking at VSA and pinbar if the conditions are met indicator = -1. (long signal)

    Now I would like to that when indicator is -1 at the next candle it buys 1 contract at entry (entry = close + 10 pips) below is the code, it is not working because it is not opening a position at all, i tried different things but i dont get it working.

    How should i write the code in order that it works? many thanks in advance

     

    // Definitie van code parameters
    DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd

    // Condities om long posities te openen
    indicator1 = CALL “VSA_final pinbar”
    c1 = (indicator1 = -1)
    entry = close[1] + (10*pipsize)

    IF c1 and tradeprice > entry THEN
    BUY 1 CONTRACT AT market
    ENDIF

    // Stops en targets
    SET STOP pLOSS 25
    SET TARGET pPROFIT 50

    #219328
    JS

    Hi Jelle,

    I set the indicator “VSA_final pinbar” for the test to -1…

    After that, you need to enter the “entry” under an “If… then” statement otherwise it changes constantly when processing a new “Close”…

    You cannot use “tradeprice > entry” here because the “tradeprice” only exists after opening a “trade”… instead of “tradeprice”, use the “Close”…

     

    #219329

    Hello JS

    thanks for your reply, i tested your proposal but i can see that it still buys at market after the pinbar is formed and not 10 pips higher than close.

    I attached a screenshot for clarification, any other suggestions?

    I tried to add an attachment but is apparently not working, I hope it is clear what i mean.

    #219330
    JS

    Hi Jelle,

    The system buys “at Market” because your code says “Buy 1 contract at Market”… 🙂

    If you want to buy at the previous close + 10*pipsize then you have to use a STOP order…

     

    #219357

    Jelle, according to what you designed yourself, this is what resembles that :

    If it now does not work, it will be because of wrong logic – not because of technicalities.

    #219574

    Hi Peter,

    I think my logic is not correct, but how do i write the code different so that it opens a position 10 pips below the close (for short) of the pinbar?

    #219605

    Hi again Jelle,

    “It is not said that you want it like this”. Why ?
    You first seem to wait until the price is extra-low, and then go Short (SellShort). This seems counter-productive, though obviously it can be part of your strategy.
    My senses tell me this :

    You have that Indicator (with for us unknown content) and it tells to go Short. What I would do is wait for the better price, which would be a higher price than the price at the moment of the Indicator telling you to go Short. Notice that you are always one bar behind. Thus for example, when the Indicator tells you that you can go Short, and the TimeFrame is 1 minute (the chart is set to bars of 1 minute) then 1 minute late you will “see” this (the program code is called at the end of each bar hence minute).

    What’s crucial for the consistency are this considerations :

    1. When the Indicator tells to go Short, the price could be dropping more and my “senses” above are wrong and won’t apply (no price will be higher than when the indicator “detected” and you will wait forever for an entry.
    2. When the Indicator tells to go Short, it may be better not to look for an even lower price, because within that past minute it may never have happened.

    Taking both into consideration, this would work best :

    But always watch the outcome of Indicator1 (with graph) because if that is not doing what you expect (it may remain 0 always) then no entry will be there ever.
    Also, maybe ensure yourself that the Indicator returns -1 indeed for Long (and I suppose 1 for Short then) because it does not seem logical to me (-1 for Short would be logical to me).

    Have fun !
    Peter

    #219759

    Hi Peter,

    this is the code I use, when green pinbar in combination with VSA it give signal -1 for long and red pinbar with VSA 1 for short.

    so if a green pinbar is formed it gives a signal of 1 and next candle the program buys a long, this strategy works reasonable but i see too often that when a green pinbar is formed the price drops further. I would like to have a condition that if a green pinbar is formed and the close of the pinbar is lets say 100 that the program on the next candel buys one long contract at 110. in the example when a green pinbar is formed and the close is 100 and the next candel drops below 100 the program should not buy and wait for the next opportunity.

     

    #219798

    Hi Jelle,

    It would be nice if you coded that indicator yourself – then we could try to let it work. I (also) mean : I like to have it working myself. Why ? see the first picture below.

    The purple down-arrow in the left hand side is yours. The yellow down-arrow in the right is mine. Notice that the pinbar I use is the bar prior to the bar prior to the entry. Thus, green in order to go short. Yours is red in order to go short, and I don’t think that is right. However, I personally go mad of upside-down thinking (what this requires) in general. Thus, the “I don’t think that is right” is actually not wrong, BUT see the 4th picture and try to wrap your head around why it is different. And why mine (yellow) looks better for start-off (keep in mind I use two bars to get to the decision).
    Notice that I did not apply further code after calling the indicator.  You, in your original post did, but I don’t think that is entry related – only best entry. I do similar in my general code and it is applied to your entry just as well.

    EXPLANATION

    I coincidentally apply the same “pinbar” method but by very different (incomparable) means. The backtest result of my method you see in the 2nd picture. Your backtest result shows in the 3rd picture.

    Notice that the code for both your and my method is completely the same – only the pinbar method was replaced hence only the entry-means was replaced.

    Your method is heavily Short oriented, which can’t be reality (this is EUR/USD and nothing in my book tells that it should be short-oriented, even if the EUR is falling gradually lately. This is not how the pinbar method would operate, on the 1 minute TimeFrame I use. So something has to be wrong in the basis.
    If you have made this code yourself, I would be nice if you put as much comment in there as you can bear. This should lead to finding the culprit(s). Anyway I can’t read it as how it is, because I did not dive into how this method should really be approached (and I don’t give myself the time to find out 😉 ).

    In any event the entries are there, so nothing wrong with that in itself.
    Regards,
    Peter

    #219816

    Hi Peter,

    I wrote the code myself, it has to be optimized. I am struggling with the settings for stoploss and profit. I use it now as an entry, as soon the program buys i stop the program and manage the trade my self because i can have a much better exit.

    But you have a nice program that makes a profit! impressive result

    if I look at the your first picture it looks like it is buying a certain amount of pips above the previous close I cant see by how much, but if I backt test mine it always buys at market.

    why should the EUR/USD not be shorted? just for my interest I am still learning about trading.

     

    #219819

    About the Buy at Market : see JS’s response. Thus the answer is simple : because you give the command to buy At Market (price). Buy at xx Limit (JS uses Stop) would wait for the price to go there and if touched, it buys. And Yes, I use at xx Limit there too.

    Of course EUR/USD can be shorted, but your Indicator makes it Short-Heavy. With that I mean that there’s way more Shorts than Longs, and that is not right. It should balance-out (about-ish). And since it does not, something has to be wrong (x – close vs close – x or something). Btw, if you swap the signals (to 1 for Long and -1 for Short) it performs better – usually no a good sign ;-).

    As said, if you put comments to everything, I can try to let it work, also based upon (PRT) experience. Comments like “0.4 means at least 40% of the candle must be the wick size” (just making up something).

    It is not an easy indicator to work with because you can have many false indications, like what the descriptions will tell you “don’t use it in the middle of a consolidation” (these are often spikey to begin with and go nowhere until …). So it is key to know that, and soon you will run into endless trials to cover for that. What you saw from my example screenshot covers for that as far as I got it at this moment, but … your Pinbar indicator made use of that very same environment (as said, it is within the same code, only the Entry “Pinbar” method was replaced by yours).

    Small hint : entry means like these will lead to many losing trades (like more than 50%) but this is fine as long as the P/L Ratio is OK (net you win more money than you lose). IOW don’t be disappointed if your Winning Trades % remains low. Later (if the net result is consistently positive) you just throw more money at it.


    In case you don’t know it yet : Replace your SET STOP pLOSS 25 with SET STOP pLOSS pLossVar and put pLossVar in an iterating Optimization Variable (see the wrench in the top-left of the Editor screen). Let it vary from 1 to 100 and observe the results. Same with the profit target. Same with everything …

    And have fun …

    1 user thanked author for this post.
    #219831

    Hi peter,

    thanks for you support and help. I will continue in the end it will work, I hope.

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

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