• Sign up >>

Find the Highest price among a groups of position

To add comments, please log in or register
xdragon
9
xdragon  

I need help make a script for EA.


I need to find the highest position and the lowest position

among a groups of position. In this groups I have Buy Position and Buystop Position!

Any body can help me?

Thank you,

Xdargon

gordon
2325
gordon  
xdragon:

I need help make a script for EA.


I need to find the highest position and the lowest position

among a groups of position. In this groups I have Buy Position and Buystop Position!

Any body can help me?

Thank you,

Xdargon

You can loop on all orders using OrderSelect(), check what type of order using OrderType() and find the highest/lowest using OrderOpenPrice().

jackyhung
13
jackyhung  
gordon:

You can loop on all orders using OrderSelect(), check what type of order using OrderType() and find the highest/lowest using OrderOpenPrice().

if you wanna get the highest or lowest in the specific time such as (one minute, 5 minutes, 30 minutes, one hour, one day,...) you can use the function :

double iHigh( string symbol, int timeframe, int shift)
Returns High value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about high prices is in the predefined array named High[].
Parameters:
symbol - Symbol on that data need to calculate indicator. NULL means current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Sample:
  Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ",  iOpen("USDCHF",PERIOD_H1,i),", ",
iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ",
iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i));
Good luck to U
gordon
2325
gordon  
jackyhung12345:

if you wanna get the highest or lowest in the specific time...

He is looking for 'the highest position and the lowest position', not high or low of a bar...

To add comments, please log in or register