Topics
11 Dec 2016, 17:24
 8211
 6
Replies

avpco
18 Dec 2016, 19:56

RE:

Hello fcomanjoncabeza.

I would like to make the Indicator, which on one chart would read the pricing information (High, Low, Close, Open) on all timeframes and all currency pairs. Please tell me how to do it. I am new to programming and would like to learn how to create trading robots and indicators. Thanks in advance.

fcomanjoncabeza said:

Hello. That's very easy:

int BarsAgo;

//Last closed bar open price
double OpenPrice = MarketSeries.Open.Last(BarsAgo);

//Last closed bar close price
double ClosePrice = MarketSeries.Close.Last(BarsAgo);

//Last closed bar high price
double HighPrice = MarketSeries.High.Last(BarsAgo);

//Las closed bar low price
double LowPrice = MarketSeries.Low.Last(BarsAgo);

If you would like to get those prices for a different symbol from the one on the chart:

int n;
MarketSeries YourSymbol = MarketData.GetSymbol(Symbol);

//Open price n bars ago
double OpenPrice = YourSymbol.Open.Last(n);

//Close price n bars ago
double ClosePrice = YourSymbol.Close.Last(n);

//High price n bars ago
double HighPrice = YourSymbol.High.Last(n);

//Low price n bars ago
double LowPrice = YourSymbol.Low.Last(n);

If n=0, then you will get the information for the actual bar. If n=1, you will get the information for the last closed bar. And so on.

 


@avpco

avpco
18 Dec 2016, 17:45

RE:

Hello fcomanjoncabeza.

I would like to make the Indicator, which on one chart would read the pricing information (High, Low, Close, Open) on all timeframes and all currency pairs. Please tell me how to do it. I am new to programming and would like to learn how to create trading robots and indicators. Thanks in advance.

fcomanjoncabeza said:

Hello. That's very easy:

int BarsAgo;

//Last closed bar open price
double OpenPrice = MarketSeries.Open.Last(BarsAgo);

//Last closed bar close price
double ClosePrice = MarketSeries.Close.Last(BarsAgo);

//Last closed bar high price
double HighPrice = MarketSeries.High.Last(BarsAgo);

//Las closed bar low price
double LowPrice = MarketSeries.Low.Last(BarsAgo);

If you would like to get those prices for a different symbol from the one on the chart:

int n;
MarketSeries YourSymbol = MarketData.GetSymbol(Symbol);

//Open price n bars ago
double OpenPrice = YourSymbol.Open.Last(n);

//Close price n bars ago
double ClosePrice = YourSymbol.Close.Last(n);

//High price n bars ago
double HighPrice = YourSymbol.High.Last(n);

//Low price n bars ago
double LowPrice = YourSymbol.Low.Last(n);

If n=0, then you will get the information for the actual bar. If n=1, you will get the information for the last closed bar. And so on.

 


@avpco

avpco
16 Dec 2016, 17:58

RE:

Hi, fcomanjoncabeza.

Thanks a lot!

fcomanjoncabeza said:

Hello. That's very easy:

int BarsAgo;

//Last closed bar open price
double OpenPrice = MarketSeries.Open.Last(BarsAgo);

//Last closed bar close price
double ClosePrice = MarketSeries.Close.Last(BarsAgo);

//Last closed bar high price
double HighPrice = MarketSeries.High.Last(BarsAgo);

//Las closed bar low price
double LowPrice = MarketSeries.Low.Last(BarsAgo);

If you would like to get those prices for a different symbol from the one on the chart:

int n;
MarketSeries YourSymbol = MarketData.GetSymbol(Symbol);

//Open price n bars ago
double OpenPrice = YourSymbol.Open.Last(n);

//Close price n bars ago
double ClosePrice = YourSymbol.Close.Last(n);

//High price n bars ago
double HighPrice = YourSymbol.High.Last(n);

//Low price n bars ago
double LowPrice = YourSymbol.Low.Last(n);

If n=0, then you will get the information for the actual bar. If n=1, you will get the information for the last closed bar. And so on.

 


@avpco