NexusFi: Find Your Edge


Home Menu

 





Unknown errors with simple code


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,946 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?
The 50/50 Paradox: Peace and Invasion Each at 20% -- Ira …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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