How to make my program sell short? - futures io
futures io futures trading



How to make my program sell short?


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

How to make my program sell short?

(login for full post details)
  #1 (permalink)
Honolulu + Hawaii / USA
 
 
Posts: 18 since Jul 2014
Thanks: 16 given, 1 received

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 futures io?
If ES tracks SPX, why do support/resistance, Level 2, vo …
Emini and Emicro Index
Second Entry Indicator (Looking for testers/feedback)
NinjaTrader
Short Interest Ratio indicator?
ThinkOrSwim
Indicators for pair trading MES and M2K
Platforms and Indicators
ZigZag with Depth and Backstep
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Selling Options on Futures?
109 thanks
Battlestations: Show us your trading desks!
108 thanks
Rank your Futures vs Stocks trading priority
55 thanks
Want your NinjaTrader indicator created, free?
27 thanks
Whats this confusion with margins?
21 thanks
 
(login for full post details)
  #3 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received


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
 
(login for full post details)
  #4 (permalink)
Honolulu + Hawaii / USA
 
 
Posts: 18 since Jul 2014
Thanks: 16 given, 1 received

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


futures io Trading Community Platforms and Indicators EasyLanguage Programming > How to make my program sell short?


Last Updated on July 9, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts