Download MetaTrader 5
To add comments, please log in or register
Download MetaTrader 5 mobile version and trade from anywhere in the world!
mrwayne
252
mrwayne 2014.04.12 10:16 

Hello guys, thanks for helping once more .

Here's a problem .
I declare Pips as a global variables, since the Pips is a += . Meaning if I run this part of function at OnTick(), it will keep on adding and adding non stop which shouldn't be correct at all .
Let say right now at this moment the pips -20.0 pips . On the 1st tick it Comment as -20.0, but then as it goes on the value become smaller and smaller and smaller . Absolutely wrong at this part .

Keith Watford
Moderator
7906
Keith Watford 2014.04.12 10:34  

Are you only checking orders that are the same as the chart symbol?

Set Pips to zero before looping through the open orders, that way it won't keep adding to previous calculations

mrwayne
252
mrwayne 2014.04.12 10:37  
GumRai:

Are you only checking orders that are the same as the chart symbol?

Set Pips to zero before looping through the open orders, that way it won't keep adding to previous calculations


No I'm checking all the OrderSymbol() currently floating .
mrwayne
252
mrwayne 2014.04.12 10:57  

Also ... I suppose ...

Am I right ?

Keith Watford
Moderator
7906
Keith Watford 2014.04.12 11:24  
juniorlcq:

No I'm checking all the OrderSymbol() currently floating .

juniorlcq:

I had taken 2, 3, 4, 5 digits broker into consideration by checking the point value once at OnInit() . * Figure = Point for 2, 4 digits broker ; Figure = Point * 10 for 3, 5 digits broker *
So what if some of the order symbols have a different point value to the chart symbol?
mrwayne
252
mrwayne 2014.04.12 11:28  
Shouldn't all the OrderSymbol() s' Point value works fine as I already check all at OnInit() ?
Keith Watford
Moderator
7906
Keith Watford 2014.04.12 12:01  
juniorlcq:
Shouldn't all the OrderSymbol() s' Point value works fine as I already check all at OnInit() ?


You don't.

If you have the EA on the EURUSD chart, Figure will = 0.0001

If you are checking a Japanese pair with

Pips += ( ( OrderClosePrice() - OrderOpenPrice() ) / Figure ) ;

Pips will be pips*100

mrwayne
252
mrwayne 2014.04.12 12:22  
OMG ... I have been using what I mention for a OrderSend() script which execute not the current symbol but different specified symbols . Will that be wrong too ?
Keith Watford
Moderator
7906
Keith Watford 2014.04.12 12:35  
juniorlcq:
OMG ... I have been using what I mention for a OrderSend() script which execute not the current symbol but different specified symbols . Will that be wrong too ?

Almost certainly
mrwayne
252
mrwayne 2014.04.12 13:01  

*Oh my ... fainted*


Thank you for correcting me !!! It's a huge mistake I'd made !!! I read the OnInit() documents again and you're right !!!

Let me recode all my work again, I'll come back here again if there's mistake again !

Thank you GumRai !! * Mucks Mucks Mucks Mucks Mucks *

Keith Watford
Moderator
7906
Keith Watford 2014.04.12 13:14  
juniorlcq:

*Oh my ... fainted*


Thank you for correcting me !!! It's a huge mistake I'd made !!! I read the OnInit() documents again and you're right !!!

Let me recode all my work again, I'll come back here again if there's mistake again !

Thank you GumRai !! * Mucks Mucks Mucks Mucks Mucks *


It's all part of the learning process, probably most of us have done something similar. I know that I have :)
/
To add comments, please log in or register