Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
Sorry.It Changed.
#property strict #property indicator_chart_window double a; double b; int start(){ for(int i=1; i <= OrdersHistoryTotal(); i++){ if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) == false) break; if(OrderType() == OP_BUY || OrderType() == OP_SELL){ a = OrderProfit(); } b += a; } Test("test",20,20); ObjectSetText("test",DoubleToStr(b,1),10,"", White); return(0); } void Test(string name, int x, int y){ ObjectCreate(name, OBJ_LABEL, 0, 0, 0); ObjectSet(name, OBJPROP_CORNER, 0); ObjectSet(name, OBJPROP_XDISTANCE, x); ObjectSet(name, OBJPROP_YDISTANCE, y); ObjectSet(name, OBJPROP_BACK, FALSE); }
for(int i=1; i <= OrdersHistoryTotal(); i++){ if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) == false) break; if(OrderType() == OP_BUY || OrderType() == OP_SELL){ a = OrderProfit(); } b += a;
- Set your variable b to zero before the loop. That is why it keeps changing.
- Add a to it inside the if block.
- Profit is OrderProfit + OrderSwap + OrderCommission.
- Do you want profit for all orders on all charts, or only for the chart's symbol, (add symbol filter?)
- Position indexes are zero through OrdersHistoryTotal - 1. You are dropping the first entry.
- Run your code through the styler so you can see the flow.
- Set your variable b to zero before the loop. That is why it keeps changing.
- Add a to it inside the if block.
- Profit is OrderProfit + OrderSwap + OrderCommission.
- Do you want profit for all orders on all charts, or only for the chart's symbol, (add symbol filter?)
- Position indexes are zero through OrdersHistoryTotal - 1. You are dropping the first entry.
Thank you very much!!
It is solved.
I won 500 000.00USD on my Demo account... How much can I transfer to my Real account??
I won 500 000.00USD on my Demo account... How much can I transfer to my Real account??
- Demo account is using virtual money.
- Real account is using real money.
Vistual money can not be transferred to the real money.
-------------
MetaTrader 5 Help - Open an Account -
Two types of accounts are available in the trading platform: demonstration (demo) and real. Demo accounts provide the opportunity to work in a training mode without real money, allowing to test a trading strategy. They feature all the same functionality as the live ones. The difference is that demo accounts can be opened without any investment and, therefore, one cannot expect to profit from them.
- www.metatrader5.com
Damn..😭😭😭
Perhaps i need an investor.
Damn..😭😭😭
Perhaps i need an investor.
You can find the broker proposing real accounts in cent (in this case: 10 dollars = 1,000 in Metatrader).
Because 10 dollars is real money, and at least - you will try/feel/know about how to trade with real money in psychological point of view for example.
You can find the broker proposing real accounts in cent (in this case: 10 dollars = 1,000 in Metatrader).
Because 10 dollars is real money, and at least - you will try/feel/know about how to trade with real money in psychological point of view for example.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I wanted to create an indicator that displays the total earnings of past transactions on the chart screen at MT 4, I created the following sample file, but when I activate the indicator on the chart screen the numbers will change and be displayed.
I think Assignment operator is a problem.
But I do not know how to improve.
I would be pleased if you could give us reasons and suggestions for improvement.
I kindly thank you.
test.mq4