Accessing Methods in Order_Mgmt.Execution

tllcoolj

Member
Joined
Jun 13, 2019
Posts
11
Likes
3
Trying to use the method "getPips" in Order_Mgmt.Execution from my custom strategy and got an error "Cannot find Symbol". I have imported the class -
import com.motivewave.platform.sdk.order_mgmt.Execution
Here is a snippit of the strategy:

public class MyStrategy extends MyStudy {
.
.
.

public void onBarClose(OrderContext ctx) {
DataContext dc = ctx.getDataContext();
Instrument instr = dc.getInstrument();
float epips = instr.getPips();
.
.
.

}
}
I'm new at Java programming and need some help in resolving this problem. Any suggestions will be appreciated.
 

Spin

Well-known member
Joined
May 22, 2019
Posts
480
Likes
192
I looked in the SDK overview (here) and could not find a method 'getPips' that can be used with a 'naked' instument.

I think you need to create an 'ExitDescriptor' first and only then you can (progammatically) 'ask' MotiveWave how many pips the price still needs to go to reach that point, or calculate a price for a StopLoss or a TakeProfit (when your strategy opens a trade with a fixed number of pips for SL / TP for instance)

Look here:
https://www.motivewave.com/sdk/java...ommon/desc/ExitPointDescriptor.html#getPips()

(I hope this is more or less what you are trying to achieve. Please clarify if it isn't :))
 

tllcoolj

Member
Joined
Jun 13, 2019
Posts
11
Likes
3
Thanks for your response. Yes, I am looking to exit the trade based on profit and loss limits set in the SettingTab. I'll implement your suggestion and see how that works out. Again.. Thanks for the input.
 
Top