NexusFi: Find Your Edge


Home Menu

 





Directional AutoTrading


Discussion in TradeStation

Updated
    1. trending_up 1,167 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?
Quantum physics & Trading dynamics
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

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