Basic code help required – market entry level

Forums ProRealTime English forum ProOrder support Basic code help required – market entry level

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

    Hi,

    I am in need of some help if possible.

    I am sure there is an easy answer to my issue, i have read the PDF manuals and unfortunately still stuck.

    I have a simple entry….
    IF not longonmarket THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF

    what i want to do now is if my buy position reaches 20 pips in profit, to increase the position by £1.

    so what command tells you the level of your entry to the market? then i can use something like IF close > “market entry” + 20 THEN BUY 1 PERPOINT AT MARKET ENDIF

    But how do you know exactly the level you got in at ?

    Any help is appreciated

    #25375

    What you call “market entry” is the price level where the last trade entry was made.

    You can retrieve it easily with the TRADEPRICE instruction.

    In your case, the example you’ll find in this documentation page is exactly what you need: Example of a simple trading strategy using MACD crossing above and below the zero line with adding orders while the price continue to get higher.

    Hope it helps.

     

    #25389

    Thanks for your help. I have tried this but cant get it to work.

    Below is my test code to get TRADEPRICE to work.

    What should happen is that i enter the market long at £1 Stop 20 pips, when the price is over 5 pips in profit it adds another £2 to the position and charnes the stop from 20 to 10 pips.

    What happens when i run the code below is it doesn’t wait for price to be above 5 pips, but enters the market at £3 and the stop is at 10.

     

     

    #25392

    What instrument please?

    #25393

    I am testing on GBPEUR on a 1 min candle chart with ProRealtime V10.3

    #25394

    Ok so 5 is 5,00000 pips!

    You’d better use ‘pointsize’ instruction to convert this value correctly to the current instrument like in this example :

    IF close – tradeprice(1) > 5*poinsize then

    #25396

    Hi Thanks Nicolas, however for me this still doesn’t work, and enters directly at £3 and reduces the stop on market entry

    #25397

    Probably need to add “if longonmarket” too in the second if statement, otherwise when you’re not longonmarket and close is more than 5 points above last trade close, the “buy 2” will happen at the same candle as the first “buy 1” (keep in mind tradeprice(1) is not “always” the last entry and is not nothing when there’s no ongoing entry, it is by definition the last price trading action whatever it was, so when you’re not longonmarket tradeprice(1) is worth last trade close, or last short entry if there are shorts too).

    So line 9 would become :

     

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