There are times during my testing of a script where the following code :
enterLong(units,entrypt,stoppt,entrypt+(10*PIP)); gives the following results: (EUR/USD::L) Long 1@1.4804 Entry stop (EUR/USD::L) Entry stop 1.4804 hit at 17:30 (EUR/USD::L) Error 010: Invalid profit limit 1.4814
[458: Fri 01.02. 17:30] -12p 1/2 high low 1.48568 1.48401
The invalid profit limit of 1.4814 is NOT invalid that I can see for a long entry of 1.4804. There are other times that the trade goes thru. I have not had success in finding anything on the forum or making a change which will solve this. The only difference I see between this and a successful entry which follows:
[499: Mon 04.02. 06:45] -3p 3/2 high low 1.48213 1.48095 (EUR/USD::L) Long 1@1.4816 Entry stop (EUR/USD::L) Entry stop 1.4816 hit at 07:00 [EUR/USD::L0000] Long 1@1.4817 Risk 15 at 06:45
[500: Mon 04.02. 07:00] -3p 3/3 high low 1.48176 1.48094
The successful entry's price of 1.4816 is contained within the high/low price of the 7:00 time period and the stop was hit at 7:00, but the Long was actually taken at 6:45? To clear this up maybe the line from 6:45 period is needed so I added it above.
The error entry's price 1.4804 is NOT contained within the 17:30 period. But if the price is not within the period, should the entry really have been made? I'm very confused by this. Would be grateful for any enlightened comments. P
Re: Invalid profit limit on entry
[Re: Pork]
#429666 09/16/1312:2409/16/1312:24
Hi JCL, I've attached a zip file with the script file and the log file rather than post it as with all the printf's to try to sort this out it is quite long. Appreciate the help. Was able to get by the errors by removing the stop value, but didn't find the reason for the error. Thanks P
Re: Invalid profit limit on entry
[Re: Pork]
#429671 09/16/1314:2909/16/1314:29
Thanks for the script. I can now see the reason of the problem.
You're entering trades at an entry stop and profit target that are both sometimes below the actual price. Therefore the entry stop is hit immediately, but the profit target is at the wrong side of the price, so the trade is rejected with an error message.
In the messages you don't see the actual price, but only your entry and profit targets. This had me also confused for a moment. We'll change that message so that the real price will also be displayed.
Re: Invalid profit limit on entry
[Re: jcl]
#429680 09/16/1317:0809/16/1317:08