# Price_diff and GetTime function

2 replies

7 years ago #111806

Dear Support,

The EA Wizard is very good, but i do not understand some functions:

1. How can I use Price Difference ( PRICE_DIFF ) function ? I would like an order when the price difference between the last order and the current rate is 5 pip.

2. I would like to trade between 8 and 16 hour. How can I use the GetTime function ?

Zsolt

7 years ago #123135

Support answerd by e-mail. Many thanks :

> 1. How can I use Price Difference ( PRICE_DIFF ) function ? I would like an order when the price difference between the last order and the current rate is 5 pip.

price difference is something els,e it is difference between two indicators.

In your case you should probably use function Open PL (in pips). This will return current difference in pips from last open order and current price.

> 2. I would like to trade between 8 and 16 hour. How can I use the GetTime function ?

it is simple, just add these conditions to the rules:

IF TimeCurrent() > GetTime(8, 0, 0)

and TimeCrrent() < GetTime(16, 0, 0)

Best Regards,

Andrew Safo

Support Team

7 years ago #123145

For the time rules, there is another option to Andrews suggestion.  What I do is use the Hour in the Time Values drop down, as seen in the attached.

For your first question, maybe I am not fully understanding what you are asking.  Andrew is correct to find the price difference of a current open or running order.  I was thinking you are asking to find out when the current price is 5 pips away from the last or closed order’s price.

If this is what you are asking, then a way you could do this is to create a variable called “Lastordersprice” or whatever you name it.  Then, you put Assign Variable in the THEN statement of your rules.  You will then assign the variable with the last order’s price and can then use that variable in your other rule that enters when price is more than 5 pips from that price in the variable (example rule is in attached).

If you want the open price of the last order, then you can do it when your rule opens the order and choose Order’s Open Price under the strategy control drop down (as seen in attached).

The tricky part will be if you want to use the closed price of the last order.  To do that you will need to Assign the Variable when a rule closes the order.  Then, you will have to figure out what could close the order and then assign the variable with that value.  So if the TP is what closes the order, then you will need to assign the value with the TP price.  If crossing an MA will close the order, then assign the value with that MA amount.  This would be easier if one of your rules closes the order.  Then, you just add Assign Variable to the WHEN part of that rule with the value.  It is more complex when the SL or TP is what closes the order and not done by a rule.  So play around with this to see if you can figure out how to do it with your EA.

Next I would suggest that you add Assign Variable = 0 when you enter a new order (if you are not using the Open price but the close price of the last order).  This will remove any price you have in this field so it will be ready for your rule to assign the new price to it.  I like using this to make sure that my rules don’t execute off a previous price level by accident.

This will take some figuring out, but it is doable if you want to.

-Stearno

Viewing 3 posts - 1 through 3 (of 3 total)