To Jforex Support,
I want to make the a modification in my strategy which is as follows :
If a trade closes in loss, its closing price should be stored in a variable, say x. The next trade should open only if it crosses x. If it results in a loss, then the next trade should also open only if it crosses x. The value of x can change only if a trade results in profit.
For example, if a EURUSD BUY trade results in a loss and closes at 1.3200, this value should be stored in a variable. The next trade should be taken only if it crosses 1.3200. If it results in loss too, then the next trade should also open only if it crosses 1.3200. This value of 1.3200 should remain unchanged until there is profitable trade.
I used the following approach :
public void onMessage(IMessage message) throws JFException {
if (message.getType() == IMessage.Type.ORDER_CLOSE_OK && message.getOrder().getState() == IOrder.State.CLOSED)
{
lastorderclosed = message.getOrder();
if (lastorderclosed.getProfitLossInUSD() < 0)
{
......................}
else
{
......................}
}
}
Kindly suggest how I should make this modification.
Regards,
Jimmy.