| Automated Trading Black box systems, strategy automation, algorithmic trading, etc... |
![]() | | Tweet | |
| | #1 | ||
![]() | Stop Trading After Profit/Loss I found some code in the TS forums that was suppose to accomplish this but it does not seem to work. Any help/suggestions would be appreciated. The TS forum code is: Variables: NP( 0 ), OPP( 0 ), PLB4Today( 0 ), ProfToday( 0 ), PTarget( 2000 ), LLimit( -660 ) ; NP = NetProfit ; OPP = OpenPositionProfit ; If date <> date[1] then PLB4Today = NP[1] + OPP[1] ; ProfToday = NP + OPP - PLB4Today ; If ProfToday >= PTarget or ProfToday <= LLimit then begin { exit all trades } Sell this bar close ; Buy to cover this bar close ; end else begin //Insert the trading code here | ||
| |
|
| | #2 | ||
![]() | Re: Stop Trading After Profit/Loss Code: If ( date <> date[1] ) Then
Begin
PLB4Today = NetProfit;
Trade_Flag = true;
End;
/// Track Today's P&L
NP = NetProfit - PLB4Today;
OPP = OpenPositionProfit;
ProfToday = NP + OPP ;
If ( ProfToday > Profit_Target$) OR ( ProfToday <= -(Day_Loss) ) Then Trade_Flag = false;
If ( Trade_Flag ) Then
Begin
// Trade Logic Here
End
Else SetDollarTrailing(0); // Exit all trades if any | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Daily stop loss/profit targets | Sparrow | Money Management | 21 | 03-29-2011 08:42 PM |
| Master the Art of Stop Loss Placement | Soultrader | Trading Articles | 4 | 10-30-2010 11:54 AM |
| NinjaTrader Stop Loss Bug - You May Looose $$$$ | rsagi | Brokers and Data Feeds | 21 | 04-16-2010 08:14 AM |
| Stop Loss Stop Loss Trailing | rod30 | Beginners Forum | 8 | 02-23-2008 10:49 AM |
| Stop Loss or Target Price? | Follow The Trend | Trading Psychology | 4 | 12-01-2006 12:54 PM |