NexusFi: Find Your Edge


Home Menu

 





Very Simple RSI Strategy - need some help


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
JCP33
Issaquah, WA
 
Posts: 3 since Mar 2023
Thanks Given: 0
Thanks Received: 1

Hello, I'm in the process of learning EasyLanguage, and am working through a bit of a learning curve. I have a simple RSI strategy that I use and would like to add two more parameters, one to the entries and the other to the exits.

My current entry point is simply on the cross above the overbought zone. My positions are very small and I have multiple positions open at the same time. The problem is that price can go in and out of that zone multiple times within a very short timeframe. Is there a way to limit the amount of entries based on the number of bars that have passed since the last entry? For instance, don't enter if the last entry was within 20 bars?

Regarding the exit parameters, was wondering if I could base the stop and the target on a multiplier of the ATR?

Hopefully this makes sense, let me know if you need further clarification. I've placed my current code below, probably a bit of a mess:

Thanks in advance!
Jacob

{ Search Tag: WA-RSI LE }

inputs:
Price( Close ) [DisplayName = "Price", ToolTip =
"Enter an EasyLanguage expression to use in the RSI calculations."],
Length( 14 ) [DisplayName = "Length", ToolTip =
"Enter the number of bars used in the RSI calculation."],
OverBought( 70 ) [DisplayName = "OverBought", ToolTip =
"Enter the level of RSI at which you consider the market to be overbought (too high)."];

variables:
RSIValue( 0 );

RSIValue = RSI( Price, Length );

[IntrabarOrderGeneration = false]

inputs:
PositionBasis( false ) [DisplayName = "PositionBasis", ToolTip =
"Enter true if currency amounts (profit targets, stops, etc.) are for the entire position; enter false if currency amounts are per share or per contract."],
Amount( 1 ) [DisplayName = "Amount", ToolTip =
"Enter the amount of the profit target (Total position amount if PositionBasis is true; amount per share if PositionBasis is set to false)."];

if PositionBasis then
SetStopPosition
else
SetStopShare;

SetProfitTarget( Amount );

{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
if CurrentBar > 1 and RSIValue crosses over OverBought then
Buy ( !( "RsiLE" ) ) next bar at market;


{ ** Copyright © TradeStation Technologies, Inc. All Rights Reserved **
** TradeStation reserves the right to modify or overwrite this strategy component
with each release. ** }


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
ATFX Suspends Prop Trading Unit ATFunded -- Full Review …
Funded Trading Evaluation Firms
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
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)
samuel3889
New York, NY
 
Posts: 5 since Mar 2023
Thanks Given: 3
Thanks Received: 0

Jacob,

You can create a variable to store the values of the ATR when you enter your position. I'm attaching part of a code I have written in the past that uses the concept to set an SL and TP based on a SuperTrend. I hope this can guide you in the right direction. Let me know if this is unclear.

-Samuel

 
Code
inputs:
	inputRR(4);

variables:
	// Trading Variables
	tradeSLVal(0),
	tradeTPVal(0),
	tradeSLPts(0),
	tradeTPPts(0);

.
.
.

if Condition1 then begin
	tradeSLVal = Round2Fraction(vSuperTrendValue); // Stores ST value
	tradeTPVal = close+(close-tradeSLVal)*inputRR; // Stores value of TP for 4:1 RR
	tradeSLPts = close - tradeSLVal; // Stores the point distance to SL
	tradeTPPts = tradeTPVal - close; // Stores the point distance to TP
	if getappinfo(airealtimecalc) = 0 then begin
		print("P/L: ", netprofit);
		buy minlist(vContractsBT, iMaxContractsBT) contracts next bar at market;
	end
	else
		buy minlist(vContractsRT, iMaxContractsRT) contracts next bar at market;
end;

setstopcontract;
setstoploss(tradeSLPts * bigpointvalue);
setprofittarget(tradeTPPts * bigpointvalue);


Reply With Quote
  #3 (permalink)
JCP33
Issaquah, WA
 
Posts: 3 since Mar 2023
Thanks Given: 0
Thanks Received: 1


Great, thanks Samuel! I will take a look at this bit later today let you know how it goes.

Much appreciated!

Jacob


Reply With Quote




Last Updated on April 3, 2023


© 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