NexusFi: Find Your Edge


Home Menu

 





Directional AutoTrading


Discussion in TradeStation

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




 
Search this Thread

Directional AutoTrading

  #1 (permalink)
AhmedF
north bergen
 
Posts: 13 since Feb 2017
Thanks Given: 3
Thanks Received: 1

I am having issues with writing a code that allows me to trade direction bias. To elaborate i want data2(larger size bars) to dictate the direction while Data1 ( smaller size bar) to dictate entry and exit. I wrote the code and it complies when i run the signal it trades both ways.

variables:
indicator ( 0) ,

var0( 0 ),
var1( 0 ),


data2var1(0),
VVSUP(false), //trending up
VVSDN(false);// trending DN



var1 = SwingIndex ;
indicator = iff (var1 <0 ,1,-1);
indicator = iff (var1 >0 ,1,-1);


//data2var1 = SwingIndex ;
data2var1 = iff (SwingIndex <0 ,1,-1);
data2var1 = iff (SwingIndex >0 ,1,-1);


if data2var1 > 0
then begin
VVSUP = true;
VVSDN = false;
end;
if data2var1 < 0
then begin
VVSUP = false;
VVSDN = true;
end;

if VVSUP then begin
if indicator crosses over 0 then buy next bar at market;
if marketposition = 1 and Indicator crosses under 0 then sell next bar at market;
end;

if VVSDN then begin
if Indicator crosses under 0 then sellshort next bar at market;
if marketposition =-1 and Indicator crosses over 0 then buytocover next bar at market;
end;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

AhmedF,

as far as I can tell you don't reference Data2 in your code. Depending on what exactly you need, I would suggest looking into how to tie variables and functions to a datastream. For accessing reserved word values on other datastreams, this link should get you going: https://www.multicharts.com/trading-software/index.php/Data

Regards,

ABCTG

Follow me on Twitter Reply With Quote




Last Updated on November 1, 2017


© 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