Hi,
I'm new here and new with Java also....
I'm trying to port my strategy from MT4 and code it in Java....
I have few questions/problems that I have a hard time to figure them out...
----------------------------------------------------------------------------------------------------------
1st; in my submitOrder command I'm using stops and profit targets...
The code I have is;
tick.getAsk() +OR- instrument.getPipValue() * myvalue
My question is; how to code that to get it rounded to 0,5 pips ???
The code isn't triggering any errors in testing....however I'm aware of this specific requirement of JForex....
I found this code:
https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=5&t=1661&hilit=rounding but
I don't know how to integrate into my Strategy and don't fully understand it....
-----------------------------------------------------------------------------------------------------------
2nd; My questioning is coming from the fact that my stop is set to 80 pips....and my Strategy work on daily chart....
However the StopLoss even if triggered, closes the trade with +200 or even +300pips loss.... sometimes it does after 80s...maybe 90s which I find ok...
but 200-300 is way off....
Does someone know why is this happening???.....is this related to my question above??? but then why it is triggered anyways ???
-----------------------------------------------------------------------------------------------------------
3rd; If the 2nd question behavior is normal; due to whatever reason, is it possible that I code an orderclose command or something similar,
which will instate a "new" stop just a bit "worst" that the original one and will close the order immediately when hit....
I explain:
1-let say my original stop is 80pips....but somehow sometimes it goes to 300.....
2-I will put another stop trough a function, at 100pips which triggers immediate orderclose....will this work ??
3-Will this second stop,
if triggered, affect the original one in such a way that the original one will trigger anyways in 200-300 pips like it happens sometimes.....
but in this case instead of closing an opened order (
which in this case was closed by 2nd stop already) it will open a opposite one ????
-----------------------------------------------------------------------------------------------------------
Thanks in advance for any help and explanations