NexusFi: Find Your Edge


Home Menu

 





Need help with Easy Language Strategy


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,800 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)
Narf9900
Fort Lauderdale
 
Posts: 1 since Oct 2013
Thanks Given: 0
Thanks Received: 0

Hi guys,

I have been working on this strategy for a few days now. It is pretty straight forward.
It is just a moving average crossover, with a RSI filter. PLA is just a special moving average
Just buy when PLAFast is above PLASlow, and RSI is above 60
Close buy when PLAFast closes below PLASlow
Short when PLAFast is below PLASlow , and RSI is below 40
close short when PLASlow closes above PLAFast .

I have a series of if statements, but I must be doing something wrong. It just chooses the first short statement, and nothing else happens.

Any Suggestions? I am totally stuck.




Inputs:
price(close),
PLAf(10),
PLAs(100),
RSILength(14),
RSIstrengthBuy(60),
RSIstrengthSell(40),
BuyDelta(0.00),
SellDelta(0.00),
antirev_on(false),
antirev_per(.25),
StopLossPoints(1000);


Variables:
pla1(0.0), pla2(0.0), RSIValue(0.0);

pla1= pla_pw(price,PLAf,antirev_on,antirev_per);
pla2= pla_pw(price,PLAs,antirev_on,antirev_per);
RSIValue=RSI(close, RSILength);
//gets pla fast and slow


{long 1 contracts at price if PLAf is above PLAs}
if CurrentBar > 1 and pla1 > pla2 and RSIValue > RSIstrengthBuy and marketposition = 0 then begin
Alert( "Fast PLA Crossover, RSI Stable" ) ;
Buy ( "PLA Crossover" ) 1 contracts next bar at (price) limit;
{Sets the stop loss in dallars}
SetDollarTrailing(StopLossPoints);

end;

If CurrentBar > 1 and pla1 < pla2 and marketposition = 1 then begin
Sell ("PLA Long Close") from entry("PLA Crossover") 1 contracts next bar at market;
end;

{short 1 contracts at price -BuyDelta if PLAf is below PLAs}
if CurrentBar > 1 and pla1 < pla2 and RSIValue < RSIstrengthSell and marketposition = 0 then begin
Alert( "Fast PLA Crossover, RSI Stable" ) ;
Sell Short ( "PLA Crossunder" ) 1 contracts next bar at (price) limit;
// {Sets the stop loss in dallars
SetDollarTrailing(StopLossPoints);
end;

//exit short when PLA closses above price.
If CurrentBar > 1 and pla1 > pla2 and marketposition = -1 then begin
Buytocover ("PLA Short Exit") from entry ("PLA Crossunder" ) 1 contracts next bar at market;
end;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
CME Cuts Precious Metals Margins Up to 21% Starting Toda …
Commodities
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
April Jobs Beat Flips Fed Hike Odds Past 52% for First T …
Traders Hideout
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


Narf9900,

when you say "It just chooses the first short statement, and nothing else happens.", what does this mean exactly? Can you show a screenshot demonstrating this behavior and also showing what it should do instead?

I would suggest to add print statements to your code to give you the ability to check the values of your variables on each bar. This will help you understand what is going on in your code.

Regards,

ABCTG


Follow me on X Reply With Quote




Last Updated on March 6, 2017


© 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