| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | EL Code for Trailing Stop ![]() Thanks in advance. if Marketposition = 0 and date = 1110621 then begin Buy ("long") 1 contract next bar at high[1] + 1 point stop; Sell short ("short") 1 contract next bar at low[1] - 1 point stop; end; if Marketposition = -1 and last >= high[1] + 1 point then begin Buy("Long") 1 contracts next bar at high[1] + 1 point stop; end; If marketposition = 1 and last <= low[1] -1 point then begin Sell short("short") next bar at low[1] - 1 point stop; end; | ||
| |
|
| | #2 | ||
![]() | Re: EL Code for Trailing Stop Quote:
What you are describing is a very high level idea. there are a lot of decisions and small operational steps in between the lines. You should transfer your thoughts onto a flowchart first, then fill in the blocks with detailed instructions.
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #3 | ||
| Re: EL Code for Trailing Stop ![]() sorry Ksungela, i shouldn't laugh, but Tams response is funny. Hay Tam you really in Geelong? I'm in Geelong and I also use Multicharts. | |||
| |
|
| | #4 | ||
![]() | Re: EL Code for Trailing Stop Quote:
One is that on the current bar[0] you are issuing an instruction to buy/sell on the next bar[-1] based on the previous bar[1]. What you should be doing is issuing an instruction to buy/sell on the next bar based on the high/low of the current one. Another problem may be that you're not specifying the point size - for instance in the @ES you have a 'big point value' (a point), and a 'small point value' (a tick, or quarter point). The 'begin . . . end' bracket seems redundant. I am not sure why you are bothering to specify the number of contracts in the code if it remains fixed throughout your strategy - just issue a buy/sell order and use the default settings on the strategy's formatting to determine the fixed number of contracts to trade. I am guessing that something like the following would produce the result you want: If Marketposition = 0 and date = 1110621 then Buy next bar at high+1 stop; If Marketposition = 0 and date = 1110621 then Sellshort next bar at low-1 stop; if Marketposition = -1 then Buy next bar at high+1 point stop; If marketposition = 1 then Sellshort next bar at low-1 stop; | ||
| |
|
| | #5 | ||
![]() ![]() | Re: EL Code for Trailing Stop If MasterBuyCondition1 = True and TimeCondition = True Then Begin Buy TradeSize Contracts next bar at market; SStop = Low[1] - StopF; LongExitCondition = 0; end; If MarketPosition > 0 Then Begin If Low[1] - StopF > SStop then SStop = Low[1] - StopF; Sell CurrentShares Contracts Next Bar at SStop Stop; end; Cheers UrmaBlume
__________________ Information = Equity | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| % Trailing Stop in Tradestation | pimind | Futures Trading Laboratory | 0 | 04-26-2009 05:46 PM |
| Intraday Trading Trailing Stop for Emini S&P | cowcool | E-mini Futures Trading Laboratory | 10 | 04-17-2009 10:09 AM |
| Looking for an ATR Trailing Stop Indicator | Fredd | Coding Forum | 3 | 03-02-2009 02:03 AM |
| Stop Loss Stop Loss Trailing | rod30 | Beginners Forum | 8 | 02-23-2008 10:49 AM |
| Optimal trailing stop percentage | al_sellatmarket | Beginners Forum | 16 | 03-28-2007 08:04 PM |