double AccountProfit( ) - how to use in an indicator?

 
Any of you rocket scientists know how to call and plot this function ?
 

By the way, people usually use this function in experts :) But u can simply add in ur indicator

AccountProfit();
// or
Print( " Profit : ",AccountProfit()); // shows ur profit(if u have some :))
If u still haven't understood attach ur indicator & show me how u want to use this function i will help u.
 

hello mymql4,

what do you mean by plotting it? AccountProfit() shows the sum of your opened positions profits +/- swaps, it doesn't have anything to do with the chart prices.

If you want to see it plotted take a look at Graph while backtesting, or you can add it as a line in the Comment() function while live testing to see it on the main window.

Good luck,

 
forexfordinner:

hello mymql4,

what do you mean by plotting it? AccountProfit() shows the sum of your opened positions profits +/- swaps, it doesn't have anything to do with the chart prices.

If you want to see it plotted take a look at Graph while backtesting, or you can add it as a line in the Comment() function while live testing to see it on the main window.

Good luck,

Hello Forexfordinner,


10 searches and 4 hours later I found this which appears to work real time -


//+------------------------------------------------------------------+
//| Current_Profits.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{

ExtMapBuffer1[0] = AccountProfit();
return(0);
}
//+------------------------------------------------------------------+
 
seifer:

By the way, people usually use this function in experts :) But u can simply add in ur indicator

If u still haven't understood attach ur indicator & show me how u want to use this function i will help u.

Hello Seifer, I tried adding to an custom indicator but got into variables issues so above seems

to work.

 
mymql4:

Hello Seifer, I tried adding to an custom indicator but got into variables issues so above seems

to work.

This bit of code DOES NOT work....... DK
 
CAN SOMEONE PLEASE HELP HERE!!??? THIS WOULD BE VERY USEFUL FOR ME IF I CAN GRAPH ACCOUNT PROFIT AS A HISTOGRAM, EVEN ON A 5 MIN CHART NOT BY THE TIC. PLEASE HELP. Daniel
 
forexman05:
CAN SOMEONE PLEASE HELP HERE!!??? THIS WOULD BE VERY USEFUL FOR ME IF I CAN GRAPH ACCOUNT PROFIT AS A HISTOGRAM, EVEN ON A 5 MIN CHART NOT BY THE TIC. PLEASE HELP. Daniel
Please don't scream or at least wait more than 22minutes between posts before u do.
 
gordon:
Please don't scream or at least wait more than 22minutes between posts before u do.
Sorry, didn't mean to "scream" ... I failed to realize the impact of all caps! haha this forum is great, just looking for some help on this one..... Daniel