Welcome to the Traders Laboratory Forums.
Automated Trading Black box systems, strategy automation, algorithmic trading, etc...

Reply
Old 01-30-2009, 09:15 AM   #9

Join Date: Jan 2009
Location: london
Posts: 17
Ignore this user

Thanks: 4
Thanked 0 Times in 0 Posts



Re: Easy Language Stop Loss Problem

i have a current issue atm and i was wondering if anyone could help me.

scaling in:

If condition3 and Condition4 and MarketPosition = 0 then begin;
Sell ("sell") Cts contracts at Market;
End;

If (Condition3 and Condition4) AND MarketPosition = -1 AND C < EntryPrice-0.0010 then Begin
sell ("Sell2") Cts contracts Market;
End;

If (Condition3 and Condition4) AND MarketPosition = -2 AND C < EntryPrice-0.0010 then Begin
sell ("Sell3") Cts contracts Market;
End;

but id also like to beable to scale out. if for instance the price went above the third order by X amount id like to close it but still keep the remaining 2 open.

someone above mentioned NAMING your orders. how exactly would i go about doing this.

thanks again for your help
Firefly is offline  
Reply With Quote
Old 01-30-2009, 10:05 AM   #10

Join Date: May 2007
Location: Toronto
Posts: 247
Ignore this user

Thanks: 8
Thanked 143 Times in 53 Posts



Re: Easy Language Stop Loss Problem

Quote:
Originally Posted by Firefly »
i have a current issue atm and i was wondering if anyone could help me.

scaling in:

If condition3 and Condition4 and MarketPosition = 0 then begin;
Sell ("sell") Cts contracts at Market;
End;

If (Condition3 and Condition4) AND MarketPosition = -1 AND C < EntryPrice-0.0010 then Begin
sell ("Sell2") Cts contracts Market;
End;

If (Condition3 and Condition4) AND MarketPosition = -2 AND C < EntryPrice-0.0010 then Begin
sell ("Sell3") Cts contracts Market;
End;

but id also like to beable to scale out. if for instance the price went above the third order by X amount id like to close it but still keep the remaining 2 open.

someone above mentioned NAMING your orders. how exactly would i go about doing this.

thanks again for your help
You have named them.

You've called them: "Sell" "Sell2" and "Sell3"

I you want to scale out you need to set a target price and Buy to Cover (for a Short) or Sell (for a Long) at a LIMIT price:

Example:
Inputs: EXITatTarget (TRUE),
Target1Qty(1);

vars: EXITPrice(0);

// Calc ExitPrice
add some logic to calc your exit based on a target or whatever...

if Marketposition=-1 and EXITatTarget =TRUE then Begin
Sell ("Target1") Target1Qty Contracts total next bar at ExitPrice Limit;
end;
bakrob99 is offline  
Reply With Quote
Old 01-30-2009, 10:47 AM   #11

Join Date: Jan 2009
Location: london
Posts: 17
Ignore this user

Thanks: 4
Thanked 0 Times in 0 Posts



Re: Easy Language Stop Loss Problem

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
Firefly is offline  
Reply With Quote
Old 01-30-2009, 11:03 AM   #12

Join Date: Jan 2009
Location: london
Posts: 17
Ignore this user

Thanks: 4
Thanked 0 Times in 0 Posts



Re: Easy Language Stop Loss Problem

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??
Firefly is offline  
Reply With Quote
Old 02-02-2009, 07:56 AM   #13

Join Date: May 2007
Location: Toronto
Posts: 247
Ignore this user

Thanks: 8
Thanked 143 Times in 53 Posts



Re: Easy Language Stop Loss Problem

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.
bakrob99 is offline  
Reply With Quote
Old 02-08-2009, 09:56 AM   #14

Join Date: Jul 2008
Location: Valdosta, GA
Posts: 48
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts



Re: Easy Language Stop Loss Problem

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
clbradley is offline  
Reply With Quote
Old 02-08-2009, 10:25 AM   #15

Join Date: Jan 2009
Location: london
Posts: 17
Ignore this user

Thanks: 4
Thanked 0 Times in 0 Posts



Re: Easy Language Stop Loss Problem

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
Firefly is offline  
Reply With Quote
Old 03-31-2009, 09:04 PM   #16

Join Date: Mar 2009
Location: LA
Posts: 6
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts



Re: Easy Language Stop Loss Problem

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:
Quote:
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 );
vanyok is offline  
Reply With Quote

Reply

Tags
profit target, stop loss

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Language Strategy Help Marc33139 Automated Trading 3 07-28-2008 12:35 PM
Need Assintance with Simple Indikator ( Easy Language ) flyingdutchmen Coding Forum 1 06-30-2008 07:32 PM
Stop Loss Stop Loss Trailing rod30 Beginners Forum 8 02-23-2008 11:49 AM
Easy ADE Problem bigboy Coding Forum 1 02-08-2008 07:59 PM
Easy Language - Help with Simple System gatrader E-mini Futures Trading Laboratory 8 12-17-2007 07:40 PM

All times are GMT -4. The time now is 04:51 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.