Need some suggestion / had anyone previously done it before ?

 

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 .

 

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

 
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 .
 

Also ... I suppose ...

Am I right ?

 
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?
 
Shouldn't all the OrderSymbol() s' Point value works fine as I already check all at OnInit() ?
 
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

 
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 ?
 
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
 

*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 *

 
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 :)
Reason: