Hi;
I am already able to capture the number of long trades and the number of short trades generated for the current date for my strategy.
Now my next targets are to capture:
TOTAL NUMBER OF LOSS TRADES FOR THE DAY
TOTAL NUMBER OF PROFIT TRADES FOR THE DAY
TOTAL LOSS/PROFIT FOR THE DAY
HIGHEST AND LOWEST PROFIT / LOSS IN ANY TRADE ON CURRENT DATE
Please give me some hint codes and I will work on it and do it.
I am a new bee and a non tech guy, please help.
Hello. @santy
Many time written here that sometimes users they doNot give enough information for what they exactly need. And for that reason that threads never have an answer.
So. by making another Duplicate thread 6 days later… will not help me at all.
Take your time please, and try to think what you need and tell us.
For example for me Manual back testing means, to see various results inside the graphic chart.
But for you, maybe you not need that.
You need to match up each individual exit price with its corresponding entry price. If you write a very simple exploration which outputs SellPrice-BuyPrice you will see why your current logic is not working.
Perhaps instead you could try something like this untested snippet:
In other words, we will only calculate profit on the bars where an exit occurred, and that profit will be the difference between the exit price on that bar and the entry price on the most recent entry signal bar. Depending on your entry and exit logic, you may need to use ExRem() to get rid of extra signals.
Of course you will still need your SumSince() logic to tally up the number of winning and losing trades.
Thanks @ Matt. its working correctly now.
Now I am just 3 steps away from completing this project. they are as below:
Capturing the total loss / profit for the day due to all the generated trades.
The highest loss making trade.
The highest profit making trade.
Please give me a starting point code and I will work on them and proceed like the previous times.
Needless to mention that with out your help and guidance I could have successfully reached this stage.
I lost all my savings in the market as like many others I traded with out any proper knowledge and strategy. I suffered a lot both financially and emotionally. However , I have now started learning things first. That is why currently I can not afford paid codes.
Thanks @ Matt. its working correctly now.
Now I am just 3 steps away from completing this project. they are as below:
Capturing the total loss / profit for the day due to all the generated trades.
The highest loss making trade.
The highest profit making trade.
Please give me a starting point code and I will work on them and proceed like the previous times.
Needless to mention that with out your help and guidance I could have successfully reached this stage.
I lost all my savings in the market as like many others I traded with out any proper knowledge and strategy. I suffered a lot both financially and emotionally. However , I have now started learning things first. That is why currently I can not afford paid codes.
You already have the longProfit and shortProfit values for each trade. By combining that with your isStartOfDay variable, you should be able to use SumSince(), HighestSince, and LowestSince() to find the total, max, and min values for each day. Give that a try, and come back to the forum if you can’t figure it out.
Of late , in connection to our old discussion (if you could remember that you helped me in coding some manual backtesting codes) i notice some problems as below and request for your help / guide in this regard:
The first line of code successfully counts the loss making trades. Then to be more accurate , i thought we should consider the brokerage and other charges also when we want to decide if a trade is loss or profit. So, i amended the lie of code as the second line of code ad considered the 3 more points.
But UUUUUUUUUUUUUUUUGGGGGGGGGGGGGHHHHH!!! its not workig and gives some fancy results!!!
Please guide me to know where the logic went wrong or what error I did. Also please help how to achieve it.
@santy, if your code is not working, then may we assume that you've used an Exploration or another method to determine how it's behaving? Tell us about the incorrect output, and how it needs to change.
The above gives total number of loss & profit trades respectively, where as they should give (I want it should work for that) the out put as the aggregate total points due to all loss making / profit making trades respectively.
Next, the below code I want them to produce the out put as the minimum loss / minimum profit making trade just after the deciding points(in my case I fixed +3 points as the cut off line i.e trades giving less than 3 points as profit are loss trades and trades giving more than 3 points are profit trades). That means I want the trade result which result is just after 3 points and just below 3 points
The same logic for catching the max profit / max loss trade, I successfully coded as below, AND ITS WORKING FINE. I just became nuts for catching the MIn loss / Min profit as its not working and all my R & D fails.
The above gives total number of loss & profit trades respectively, where as they should give (I want it should work for that) the out put as the aggregate total points due to all loss making / profit making trades respectively.
Next, the below code I want them to produce the out put as the minimum loss / minimum profit making trade just after the deciding points(in my case I fixed +3 points as the cut off line i.e trades giving less than 3 points as profit are loss trades and trades giving more than 3 points are profit trades). That means I want the trade result which result is just after 3 points and just below 3 points
MINPROFITTRADE = HighestSince (isStartOfDay, longProfit + shortProfit)>3;
MINLOSSTRADE = LowestSince (isStartOfDay, longProfit + shortProfit)<3;
The same logic for catching the max profit / max loss trade, I successfully coded as below, AND ITS WORKING FINE. I just became nuts for catching the MIn loss / Min profit as its not working and all my R & D fails.
MAXPROFITTRADE = HighestSince (isStartOfDay, longProfit + shortProfit);
MAXLOSSTRADE = LowestSince (isStartOfDay, longProfit + shortProfit);