NexusFi: Find Your Edge


Home Menu

 





Unknown errors with simple code


Discussion in EasyLanguage Programming

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




 
Search this Thread

Unknown errors with simple code

  #1 (permalink)
greggotanafro
Dallas + Texas
 
Posts: 4 since Apr 2020
Thanks Given: 2
Thanks Received: 1

Hey friends. Its me again! I've been in this code for literal hours and I can NOT figure out what the heck is wrong. It doesn't make any trades or print correctly when added as a strategy to a chart in TradeStation nor will it trade in a backtest...Help please?!


 
Code
inputs:  
	SignificantUp(500),
	RSILength(14),
	OverSold(30),
	OverBought(70),
	TickNeutral(0);
	
Vars:
	TickVal(0),
	RSIval(0),
	MP(0),
	counter(1);
	 
{Setup }
TickVal= last of Data2; {DATA2 is $TICK}
Rsival= RSI( Close, RSILength );
MP = Marketposition;

{ENTERING CRITERIA}		
if  MP=0 And Time > 0900 and Time < 1455 And  Rsival <= OverSold And  TickVal >= SignificantUp Then  
		Begin
				Buy ("Long Entry") next Bar market; 
				print("-----Buying Order #",counter, "-----");
				print ("Position Opened: ",Date:4:0, Time:4:0);
				print("RSI: ",Rsival);			
				print("TICK: ", Close of Data2);
				print("Acquired Price:",Last of Data1);
				print("-------------------------------------------------------------------");
				counter=counter+1;

		End;
{EXITING CRITERIA} 
		
	
			If MP=1 And (Time > 1455 Or RSIVal >= OverBought Or TickVal < TickNeutral) Then
				Begin
					Sell ("Long Exit") Next Bar at Market;
					print("-----Selling Order #", counter, "-----");
					Print("Position Closed: ",Date:4:0, Time:4:0);
					print("Sold Price:",last of Data1);
					print("--------------------------------------------------------------");
				End	;		
			

		End;
This code IDEALLY would check to see if it's between a certain time to trade and if RSI and TICK look good, make the trade, then exit the position of TICK goes from positive to negative or if RSI is overbought or if its near market close.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Quantum physics & Trading dynamics
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
24 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
17 thanks
GFIs1 1 DAX trade per day journal
13 thanks
EG Indicators
11 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

greggotanafro,

from glancing at your code you are using "Last", a Quote Fields that doesn't carry history. Is there a reason for not using "Close" here instead?

Apart from that it might help to provide as much information as possible (for example about the exact chart setup) as this would enable futures.io users to reproduce what you are seeing.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on April 22, 2020


© 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