I'm programming a strategy that modifies the size of the entry order based upon how well the strategy has done in the recent past. This is somewhat easy to accomplish by looking back at the PositionProfit(1), PositionProfit(2), etc. values. For this particular strategy, if the last two trades were profitable, we increase the trading size for the next trade by "x" contracts. If the last two trades were both unprofitable, we reduce the trading size for the next contract by "y" contracts. That works fine.
Here's the conundrum: in the event that the strategy has, let's say, four losing trades in a row, is it possible to have the strategy trade "zero" contracts UNTIL a subsequent signal is profitable? In other words, the market logic would be:
1. If last 4 trades were unprofitable, take the next signal with zero contracts
2. If the subsequent trade done with zero contracts was "profitable", then enter the following signal with 1 contract.
I know, it sounds kinda strange, but I'm wondering whether MultiCharts can be used to express that kind of logic. Any thoughts or ideas would be appreciated.
This may be a strange question ...
- furytrader
- Posts: 354
- Joined: 30 Jul 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: This may be a strange question ...
1. use a general condition. eg.
Code: Select all
if unprofitable.trades < 4 then
begin ...
- furytrader
- Posts: 354
- Joined: 30 Jul 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
Re: This may be a strange question ...
Thank you for your response, although I'm not sure I completely understand it. Can you explain how that solution would tell us whether a trade done with zero contracts would've been profitable?
Again the logic would be:
Line 1. If Last Trade is Profitable, trade next trade using 1 contract;
Line 2. If Last four trades were unprofitable, trade next trade using 0 contract.
[In essence, if the last four trades were unprofitable, we're just watching the signal then, not trading real money. However, if that "watched signal" would've made money, had we traded it with one (or more) contracts, we want to enter the next trade with 1 contract, per Line 1.]
I know, it's a weird question but I thought I'd throw it out there.
Thanks again.
Again the logic would be:
Line 1. If Last Trade is Profitable, trade next trade using 1 contract;
Line 2. If Last four trades were unprofitable, trade next trade using 0 contract.
[In essence, if the last four trades were unprofitable, we're just watching the signal then, not trading real money. However, if that "watched signal" would've made money, had we traded it with one (or more) contracts, we want to enter the next trade with 1 contract, per Line 1.]
I know, it's a weird question but I thought I'd throw it out there.
Thanks again.
-
- Posts: 36
- Joined: 04 Feb 2010
- Location: Calgary, AB Canada
- Has thanked: 7 times
- Been thanked: 19 times
- Contact:
Re: This may be a strange question ...
Rather than attempting to submit a 0 contract order, your can just have your strategy remember the current market prices at the time you would have otherwise entered and exited the position when you have a 0 share condition based on your profit/loss assessment. Something like this could work:
For entry:
Hope this helps!
For entry:
Code: Select all
if (BuySignal) then
begin
if (lastUnprofitable and ShareSize = 0) then
entryPrice = insideask
else
Buy ShareSize shares ...
end;
Code: Select all
if (ExitSignal) then
begin
if (lastUnprofitable and ShareSize = 0) then
begin
exitPrice = insidebid;
Profit = insidebid - insideask;
<additional profit/loss handling code>
end;
end;
- furytrader
- Posts: 354
- Joined: 30 Jul 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
Re: This may be a strange question ...
Thank you for that suggestion. I thought about this idea for a while and I agree, that's the optimum solution - have the program note when a trade "would've" been taken and use that to evaluate whether that faux trade would be profitable. I don't think it would be that hard to do, depending on the market logic used by the system.
Thanks again for your help, and your help too, TJ. I appreciate it.
Thanks again for your help, and your help too, TJ. I appreciate it.