Automated Trading Thread, Easy Language Stop Loss Problem in Trading Styles and Methods; Hi, thanks for replying to my post. unfortunately i still cant get it to work. when i input "EXITPrice(0) in ...  | | Re: Easy Language Stop Loss Problem

01-30-2009, 09:47 AM
| | | | Join Date: Jan 2009 Location: london
Posts: 17
Thanks: 4
Thanked 0 Times in 0 Posts
| | Hi, thanks for replying to my post. unfortunately i still cant get it to work. when i input "EXITPrice(0) in the variables it doesnt like it.
i was trying to get the following:
if marketposition = -2 AND the price of"sell2" < CURRENTPRICE+0.0005 then begin:
obviously easy language doesnt like that though + i had a look at EXITprice and it says the following:
If last trade exited at 455.75 then ExitPrice(1) = $455.75
im not sure thats what im looking for | Re: Easy Language Stop Loss Problem

01-30-2009, 10:03 AM
| | | | Join Date: Jan 2009 Location: london
Posts: 17
Thanks: 4
Thanked 0 Times in 0 Posts
| | thanks for your reply but i cant get it to work. im looking to compare the price of "sell2" to the current price + or - a certain amount. if this is then true id like to close one of my positions.
the definition of exit price i got said it returned the value of the last exit.... if u placed[1] at the end and that it could be used to compute the last 10 prices. im not sure thats what i was looking for.
any other ideas?? | Re: Easy Language Stop Loss Problem

02-02-2009, 06:56 AM
| | | | Join Date: May 2007 Location: Toronto
Posts: 215
Thanks: 7
Thanked 85 Times in 37 Posts
| | Whenever I am debugging a strategy I use the EasyLanguage Output Bar and a Print line to help understand what is going on.
Example:
PRINT Barnumber," Date ",Date," Time ",Time," MarketPosition ",MarketPosition," EntryPrice ", EntryPrice," ExitPrice ",ExitPrice);
Then I would consider how to best retain or refer to the value you are looking for. | Re: Easy Language Stop Loss Problem

02-08-2009, 08:56 AM
| | | | Join Date: Jul 2008 Location: Valdosta, GA
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
| | If I wanted to use the Hull Moving Average (jtHMA) for a crossover strategy instead of a simple or exponential moving average crossover strategy, how would it be coded in Easy Language for a fast length jtHMA(10) and a slow length jtHMA (20) with parameters that if fast avg jtHMA crosses above slow avg jtHMA then BuyLong 100 shares next bar at market, and SellShort if reverse, and would like to be able to displace the jtHMAs + or -1, 2, or 3, and will be using this on a 30 or 60 min. timeframe?
Also, is it possible, or even necessary, to put within the strategy a buy/sellshort order with a pre-set stoploss? Possibly something like:
If conditions are met for fast jtHMAavg crosses slow jtHMAavg, then begin;
buy/sellshort 100 shares next bar at market;
SetProfitTarget(1000);
SetStopLoss( 100);
end;
This is going to be my first time using a strategy for Tradestation, and want to backtest it, haven't tried that and not sure how to figure it in for possible flaws and slippage for backtesting. I'm going to use it on a 2x or 3x Proshares or Direxion index fund, and the position will reverse immediately when the jtHMAs cross on the next bar after the cross, from long to sellshort, or vice-versa. Not sure if that brings more problems, the instant reversal.
Thanks for any help.
Curtis | Re: Easy Language Stop Loss Problem

02-08-2009, 09:25 AM
| | | | Join Date: Jan 2009 Location: london
Posts: 17
Thanks: 4
Thanked 0 Times in 0 Posts
| | dont know anything about this moving average thing ur talking about so cant help there... sorry
Inputs: inputa,
inputb,
inputc;
Variables: vara,
varb,
varc;
Condition1: jtHMAavg1[1] > jtHMAavg2[1]
Condition2: jtHMAavg1[1] < jtHMAavg2[1]
If condition1 then begin;
Buy ("buy long") 100 Cts contracts next bar at market;
End;
If condition2 then begin;
sell ("sell short") 100 Cts contracts next bar at market;
End;
SetProfitTarget(1000);
SetStopLoss( 100);
that SHOULD be right but i havent checked it in easy language as im just going out but it should give u an idea of how it possibly should look.
hope that helps | Re: Easy Language Stop Loss Problem

03-31-2009, 08:04 PM
| | | | Join Date: Mar 2009 Location: LA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
| | First post!
Did you ever get this to work ?
You're forgetting one important statement. I believe the order system is configured for equities by default. you have to specify that you're trading contracts...
From the EasyLanguage manual:
SetStopShare or SetStopContract - exits are calculated per share or contract.
| So your could would need to be something like:
Inputs: StopAmt(1), ProfitAmt(1);
SetStopContract;
SetStopLoss(StopAmt);
SetProfitTarget(ProfitAmt ); | Re: Easy Language Stop Loss Problem

04-09-2009, 05:03 AM
| | | | Join Date: Jul 2008 Location: Valdosta, GA
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
| | Can you use a
SetProfitTarget(33%);
SetStopLoss(8%);
using a % instead of a number, and is that how you code it, and how do you code an ATR trailing stop I've seen several authors refer to using to implement a stop loss?
Thanks for any help. | Re: Easy Language Stop Loss Problem

11-20-2009, 01:20 PM
| | | | Join Date: Nov 2009 Location: Niles
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
| | So why wouldn't this work?
If MarketPosition = 1 then
Begin
SetStopShare ;
SetStopLoss ( LongEntryPrice - (0.002 * LongEntryPrice) ) ;
End ;
If MarketPosition = -1 then
Begin
SetStopShare ;
SetStopLoss ( ShortEntryPrice + (0.002 * ShortEntryPrice) ) ;
End ; | Re: Easy Language Stop Loss Problem

12-04-2009, 08:07 PM
| |
Tams
doesn't care about your sim blotter... LOL
| | Join Date: Sep 2008 Location: Geelong
Posts: 2,234
Thanks: 1,250
Thanked 939 Times in 558 Posts
| |
Originally Posted by drosengarden So why wouldn't this work?
If MarketPosition = 1 then
Begin
SetStopShare ;
SetStopLoss ( LongEntryPrice - (0.002 * LongEntryPrice) ) ;
End ;
If MarketPosition = -1 then
Begin
SetStopShare ;
SetStopLoss ( ShortEntryPrice + (0.002 * ShortEntryPrice) ) ;
End ; |
SetProfitTarget and SetStopLoss orders
are posted to broker when there is an open position.
The target and stop will be automatically* withdrawn
if the position is closed.
* automatic means you do not need to code a logic to withdraw the orders,
they are done automatically as soon as the position is closed.
__________________ It appears to be some great stuff and if you ever feel like discussing a possible business arrangement, let me know. I'm always looking for ways to improve. .....LOL
Last edited by Tams; 12-04-2009 at 08:18 PM.
| Re: Easy Language Stop Loss Problem

02-14-2010, 02:26 PM
| | | | Join Date: Dec 2007 Location: Yorkville
Posts: 39
Thanks: 14
Thanked 38 Times in 16 Posts
| | One thing I've found using the stoploss feature is that if you have multiple strategies running, you should be aware that the stoploss execution doesn't care from which strategy it is triggered. |  | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |