NexusFi: Find Your Edge


Home Menu

 





Unknown errors with simple code


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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 NexusFi users to reproduce what you are seeing.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:




Last Updated on April 22, 2020


© 2026 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 - Downloads - Top
no new posts