NexusFi: Find Your Edge


Home Menu

 





How to make my program sell short?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,198 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?
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Bigger Wins or Fewer Losses?
24 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


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