Working with pips

In Forex markets is very common to use values in pips. For most Forex pairs the value of 1 pip is 0.0001 but for others it is 0.01 or even 0.1.

Expert Advisors usually have external parameters that require values in pips. We can also create external parameters in pips in Trading SM. Let’s see how to accomplish this in the Distance parameter used in the MA Crossovers Expert Advisor of the Getting Started tutorial.

First of all, we add a new external parameter that will hold the value of 1 pip. A Metatrader user will need to modfify this value taking into account the symbol in which the EA operates: 0.0001, 0.01 or 0.1.

 

Now that we have a Pip Value parameter in Trading SM, we create an operation that converts pip values to real values.

 

Now, in the original Distance parameter we may set 5 instead of 0.0005. Also, we make it external allowing a Metatrader user to customize the Expert Advisor.

Finally, we change on each condition the Distance parameter and select the Real Distance instead.

 

Trading SM trading Actions use real values instead of pips. This is good because we can use Trading SM to create Expert Advisors for any other market than Forex.

We save the robot and compile again. From now on, we have to provide the Distance value in pips in Metatrader.