Find orders
-
@roar And i am using this on Mt4 platform

-
@seemab said in Find orders:
@roar As in your picture ( the terminal is having profit of 136 dollars ) and 1 trade is in -1 dollar, ( so the profit of the total trades is 136 dollars ) but the comment of chart is showing 137 dollars.
I need only profit of trades which are in profit not all the trades.This doesnt make sense. 137 dollars is the profit-only trades, just as you wanted. I can check that you copied it right, if you send the shared link
-
@roar this is the link and i have created an Area with your name title in which your given blocks are used.
https://fxdreema.com/shared/yBQtRfQud -
@seemab you must reset the totalprofit variable before the EA calculates it again, otherwise it stacks values of each calculation

-
@roar thank you so much it's working now. i set it 0.
But now i am stuck in a simple variable calculation.
https://fxdreema.com/shared/LRz503fUc
In this i have added an area need help where i need help.
When bucket of trades are closed i get there profit in variable A every time.
Now i want to add previous A profit value in next profit A value every time when trades are closed and get results in B variable. Please if you can help. -
@seemab These blocks will be run on every new tick, not just when there happens some trade action. Check the On Trade tab, there are launching blocks to activate only when a trade is closed, maybe that gets you forward.

Sorry Timmyhanke for hijacking your thread lol
-
@roar i have tried it also on trade event but still not when trades are closed it's increasing the values in B variable not giving as it should be, even i have reset the A variable too 0 after updating it.
Please have look on it and give any ideas, i will be appreciating your help.
https://fxdreema.com/shared/m2bWPVFgb -
@seemab ok, what are you trying to do?
You have 2 groups (buckets) of trades, and you want to know their combined profit? Is this the net profit or only the positive trades?What is the final purpose of all this? Maybe I'll know some different approach
-
@roar in bucket of trades i am collecting profit of only last 2 trades which are closed ( 1 from top buy trade and 1 from bottom buy trade ) and give it's result in variable A as total profit of both trades ( in this top trade -1 dollars and bottom trade +3 dollars so, 3-1 = 2 = value in A variable). Now as i get A variable value 2, and when next 2 trades which will be closed 1 top and 1 bottom give collect it's value and update in A variable as well add previous profit value which was 2 in current profit value may it can 5 or 10 or 2 what ever it is.
-
@roar ( completing reply here ) and what ever it is, and update results in B variable, So like this every time A will be updatings profits of closeds trades and adding also previous profits which are in B variable now and giving results in B variable.
-
@seemab you are thinking in terms of top and bottom buy trades, but the EA doesnt separate them as such. It makes the calculations every time some trade is closed, not when a pair of 2 trades is closed.
So your goal is to track total profits in variable "B"?
-
@roar yes my goal is too get total profit in variable B, for top and bottom buy trades i am already getting there profit no problem for now. Problem is when i get there profit in variable A and want too add them in previous profit which i got in last closed. It keep adding it not only once.
In simple 1st time closed trades profit = 2 in variable A.
Now the value will be same also in variable B because this is 1st close of trades.
Now when 2nd time trades close there profit is 5 dollars.
Now i want too add 2 in this current updated profit which i get in A variable and give results in B variable.
Previously B was same as A value, now previous B = 2 and current A = 5 = 2+5 = 7 in variable B.
When 3rd close happens A get update value of 7 dollars.
So now we have B = 7 + 7 = 14 in variable B. And So until it hit block close all trades. -
@seemab said in Find orders:
@roar yes my goal is too get total profit in variable B, for top and bottom buy trades i am already getting there profit no problem for now.
I dont think you are getting the right profit amouts.
You need a nice pair of top and bottom trades, and then sum their profits:

But in reality, the "bucket of trades" will always take 2 history trades when some trade closes, so every trade will be recorded twice:

-
@roar i know this this will happen in future when many trades will be closing but please currently i only need this.
I get some value in A, and A updates every time with new value when trades are closed.
So whenever new value is updated in A variable add previous value of A and update in B variable. simple calculation for now only. -
@seemab you are already doing that

-
@roar
But it's not working correctly, it keep's adding after every trade or closed but it's not giving right value, i am confuse on it. -
@seemab again, why do you need this pairing of 2 trades? Try setting the bucket to only 1 trade, does that work for you?

-
@roar can you please tell me, if A variable get updated every trade even 1 trade in bucket of trades we just get the value in A.
Now simply add previous A value in A current updated value and give results in B.
How too do this ? -
@seemab you need A, B and C for that.
When a trade closes, put old contents of A into B. Then update A with new info. Then set C = A + B + C
-
@roar any blocks example please.