Hi all,
is there a code for "do not open a new position if during the current session you have been stopped"?
"If entriestoday(date)=0..." works only if I opened the position during this session. I'd like something that works if my original position was opened yesterday or earlier...
Thanks!
Don't trade if stopped
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Don't trade if stopped
You might try these functions:
Marketposition and positionproft. (or openpositionprofit).
Marketposition and positionproft. (or openpositionprofit).
Re: Don't trade if stopped
thanks but I suppose it doesn't work because after you have been stopped your MP and PP will be 0 and a new trade will be allowd again...You might try these functions:
Marketposition and positionproft. (or openpositionprofit).
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Don't trade if stopped
You can also try the PosTradeExitCategory keyword. With that keyword we can lookup what kind of order closed a position (i.e., was it a stop order, limit order, market order?). That way you can check if the position was stopped out or reached its profit target.
See PosTradeExitCategory for more.
See PosTradeExitCategory for more.
Re: Don't trade if stopped
Thank you Josh, that's a good keyword but a problem still exists, e.g if I got stoppet 3 days ago I want to have the trade today if conditions are met. The only case I don't want to trade is when I get stoppet today and today I also have the condition for the trade. PosTradeExitCategory don't refers to a specific day but only to a specific kind of exit...so how can I say "if I got stoppped and this appened today"?You can also try the PosTradeExitCategory keyword. With that keyword we can lookup what kind of order closed a position (i.e., was it a stop order, limit order, market order?). That way you can check if the position was stopped out or reached its profit target.
See PosTradeExitCategory for more.
thanks
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Don't trade if stopped
Yes, but you can combine PosTradeExitCategory() with other keywords to get the time a particular position was opened or closed.Thank you Josh, that's a good keyword but a problem still exists, e.g if I got stoppet 3 days ago I want to have the trade today if conditions are met. The only case I don't want to trade is when I get stoppet today and today I also have the condition for the trade. PosTradeExitCategory don't refers to a specific day but only to a specific kind of exit...so how can I say "if I got stoppped and this appened today"?
But do you close down MultiCharts at the end of the day, and start it again the next day? Because those keywords like PosTradeExitCategory() only work when your strategy keeps running all the time. If you stop auto-trading, MultiCharts cannot retrieve the position data from 3 days ago.