Account Based Indicators

 

Hello Everyone!

Is there any history deals based indicator around? Almost all of them are market based, but almost none is account based.

I've seen a product that created an indicator based on profit, but what if I wanted to know my position moving average plotted with market candles?

Many thanks,

Arthur.

 

A post with a link to a market product has been deleted.

Do not mention or link to any specific market product/signal in the forum.

This could be considered promotion and can result in a ban.

 
Arthur Albano:

Hello Everyone!

Is there any history deals based indicator around? Almost all of them are market based, but almost none is account based.

What is "account based" in opposition to "market based" ?I don't get it.

I've seen a product that created an indicator based on profit, but what if I wanted to know my position moving average plotted with market candles?

What is a "position moving average" ?

 
Alain Verleyen:
What is "account based" in opposition to "market based" ?I don't get it.

What is a "position moving average" ?

On a Netting account, a simple PositionGetDouble(POSITION_PRICE_OPEN) will do, as netting account allows one position for a single symbol. The (untested, notepad) snippet below, should give a glimpse that should work on netting and hedging accounts:

sinput string InpSymbol = "";

string ExtSymbol = "";

int OnInit()
{
   if(!SymbolSelect(InpSymbol)) ExtSymbol = _Symbol;
   if(!ObjectCreate(0,"PositionPriceOpen",OBJ_HLINE,0,0,PositionPriceOpen(ExtSymbol));
   return(INIT_SUCCEDED);
};

void OnDeInit()
{
   ObjectDestroy("PositionPriceOpen");
};

void OnTick()
{
   ObjectMove(0,"PositionPriceOpen",0,0,PositionPriceOpen(ExtSymbol));
};

double PositionPriceOpen(const string SYMBOL)
{
   double PositionVolume = 0.0;
   double PositionValue = 0.0;
   for (int i=0;(i<PositionsTotal())&&PositionSelect(i); i++)
   {
      if(PositionGetString(POSITION_SYMBOL)==SYMBOL)
      {
         PositionValue =+ PositionGetDouble(POSITION_PRICE_OPEN) * PositionGetDouble(POSITION_VOLUME);
         PositionVolume =+ PositionGetDouble(POSITION_VOLUME);
      };
   };
   return((PositionVolume>0)?(PositionValue/PositionVolume):SymbolInfoDouble(ExtSymbol,SYMBOL_LAST));
};

I believe using HistoryDealGetDouble can populate buffer calculations and create a moving average of my own position, using two buffers, one for calculations and another for the indicator.

 
Arthur Albano:

On a Netting account, a simple PositionGetDouble(POSITION_PRICE_OPEN) will do, as netting account allows one position for a single symbol. The (untested, notepad) snippet below, should give a glimpse that should work on netting and hedging accounts:

I believe using HistoryDealGetDouble can populate buffer calculations and create a moving average of my own position, using two buffers, one for calculations and another for the indicator.

I believe I will borrow Masters @Mladen Rakic and @Alain Verleyen code...

https://www.mql5.com/en/forum/275327/

If I am able to move forward, I will post code here.

Self-regressive Median Coefficient
Self-regressive Median Coefficient
  • 2018.08.23
  • www.mql5.com
Hi all, I am trying to build an indicator that uses the following formula and returns the expected value, so I can use the same chart as indicator_...