NexusFi: Find Your Edge


Home Menu

 





How to make my program sell short?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,203 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

How to make my program sell short?

  #1 (permalink)
honoluluhustler
Honolulu + Hawaii / USA
 
Posts: 18 since Jul 2014
Thanks Given: 16
Thanks Received: 1

Aloha,
Trying to have my program sell short the TF, once certain parameters are met. When I go to backtest the strategy it is not performing how I expected, with it selling short and then immediately triggering stop loss on days when there is a ski slope down. What am I missing? Since I am selling short, does the STP and TGT need to be negative?
Mahalo

{short Russell}
Inputs:
Price( Open ),
Length1 ( 12 ),
Length2 ( 15 ),
Cts ( 1 ),
TGT ( 300 ),
STP ( 100 );

Vars:
ExpAv1 ( 0 ),
PrevNetProfit ( 0 ),
PrevNetLoss ( 0 ),
StopTrading (false),
ROC1 ( 0 );

ExpAv1 = XAverage ( Price, Length1 ) ;
ROC1 = ( PRICE - PRICE[Length2] ) / PRICE[Length2] * 100 ; { RATE OF CHANGE }

if Date <> Date [1] then
begin
PrevNetProfit = NetProfit;
StopTrading = false;
end;

if NetProfit >= PrevNetProfit + 100 then StopTrading = true;

if Date <> Date [1] then
begin
PrevNetLoss = GrossLoss;
StopTrading = false;
end;

if GrossLoss >= PrevNetLoss + 80 then StopTrading = true;

{Buy or short sell contracts at exponential average crossovers}

if volume > 2000 and ROC1 < 1 and Price[1] crosses below ExpAv1[1] then
begin
Sellshort ( "sellshort") Cts contracts next bar at market ;

setprofittarget (TGT);
setstoploss (STP);

end;

value97 = text_new ( D, T, ExpAv1, "*" );
text_setcolor (Value97, Cyan);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


honoluluhustler,

"Since I am selling short, does the STP and TGT need to be negative?" - No, the strategy will figure that out.
Why do you include the stop and target within the entry condition? This means they are only active when the entry conditions are. So you will likely have times when you are in the market, but without a stop and target.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
honoluluhustler
Honolulu + Hawaii / USA
 
Posts: 18 since Jul 2014
Thanks Given: 16
Thanks Received: 1

So move

Setprofittarget and setstoploss on the outside after the end;

if volume > 2000 and ROC1 < 1 and Price[1] crosses below ExpAv1[1] then
begin
buy ( "buy") Cts contracts next bar at market ;

end;

setprofittarget (TGT);
setstoploss (STP);

Reply With Quote




Last Updated on July 9, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts