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. ** }
|