EasyLanguage Programmers! I need your HELP! - futures io
futures io



EasyLanguage Programmers! I need your HELP!


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one sixhundread with 8 posts (0 thanks)
    2. looks_two artisanpro with 5 posts (2 thanks)
    3. looks_3 ShadowFox with 4 posts (5 thanks)
    4. looks_4 SunTrader with 1 posts (2 thanks)
      Best Posters
    1. looks_one SunTrader with 2 thanks per post
    2. looks_two acosta1709 with 2 thanks per post
    3. looks_3 ShadowFox with 1.3 thanks per post
    4. looks_4 artisanpro with 0.4 thanks per post
    1. trending_up 5,309 views
    2. thumb_up 11 thanks given
    3. group 6 followers
    1. forum 19 posts
    2. attach_file 4 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

EasyLanguage Programmers! I need your HELP!

(login for full post details)
  #11 (permalink)
artisanpro
toronto canada
 
 
Posts: 19 since May 2021
Thanks: 20 given, 9 received

Here are the settings : don't ask why the initial cap was set at 88$ I don't know but I will redo it with 5,000$ in the next few minutes.


NOTE: Something weird going at my end - results are the same with changes in settings So, someone should redo the performance report to have a better view of profitability.


USDCAD 500 days settings 2021-07-19_1531

Reply With Quote

Can you help answer these questions
from other members on futures io?
Big Mo Indicator for NT8
NinjaTrader
How do I create Strategy with the Second Entry indicator
NinjaTrader
Market on Close data within IB
Platforms and Indicators
help with take profit several targets
TradeStation
Multi Time Frame High/Low/Median levels
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
88 thanks
An embarrassing, honest confession
25 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
ApexTraderFunding.com experience and review
8 thanks
Want your NinjaTrader indicator created, free?
7 thanks
 
(login for full post details)
  #12 (permalink)
sixhundread
Vienna and Austria
 
 
Posts: 36 since Jul 2021
Thanks: 21 given, 7 received


artisanpro View Post
Yes, it is correct - it compiles and makes money as seen on the attachment showing the last 500 days of USDCAD

NOTE: see caveat on next post

USDCAD 500 days 2021-07-19_1523

but i think it has a mistake.

for "sell " and" buy to cover" there should be a "or" instead of a "and".

am I right?

Reply With Quote
 
(login for full post details)
  #13 (permalink)
artisanpro
toronto canada
 
 
Posts: 19 since May 2021
Thanks: 20 given, 9 received


Your suggestion of "or" will work as well but will give a different result


inputs:
length(13);

vars:
MyEMA(0),
MyMACD(0),
MACDHist(0);

MyEMA = XAverage(close,length);
MyMACD = XAverage(close,12) - XAverage(close,26);
MACDHist = MyMACD - XAverage(MyMACD,9);

{ these 2 lines are not used
Value1 = High;
Value2 = Low;
}

{
// initial code by
if marketPosition = 0 and MyEMA > MyEMA[1] and MACDHist > MACDHist[1] Then
Buy next bar at Open;

if marketposition = 1 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Sell next bar at Open;

if Marketposition = 0 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Sellshort next bar at open;

if Marketposition = -1 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Buy to Cover next bar at Open;
}

// is this what you mean with the "OR"
// well, that would work as well but will give a different result
// which I can't test reliably for now
if marketPosition = 0 and MyEMA > MyEMA[1] and MACDHist > MACDHist[1] Then
Buy 1 contract next bar at Open;

if marketposition = 1 and MyEMA < MyEMA[1] OR MACDHist < MACDHist[1] then
Sell 1 contract next bar at Open;

if Marketposition = 0 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Sellshort 1 contract next bar at open;

if Marketposition = -1 and MyEMA < MyEMA[1] OR MACDHist < MACDHist[1] then
Buy to Cover 1 contract next bar at Open;

Reply With Quote
 
(login for full post details)
  #14 (permalink)
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
 
ShadowFox's Avatar
 
Posts: 116 since Jun 2020
Thanks: 69 given, 156 received

There is no need to sell and sell short with the same conditions. If you sell short and you are long, tradestation will close the long and sell short (reverse the position). You just need to sell short or buy to change directions.

Here is an example
Disclaimer: I would not trade this system. This is purely hypothetical to show EasyLanguage code. I am in no way saying this is profitable or not.

 
Code
inputs:
length(13),
ContractsTraded(1),
SL(900)//amount of SL
;

vars:
MyEMA(0),
MyMACD(0),
MACDHist(0);

MyEMA = XAverage(close,length);
MyMACD = XAverage(close,12) - XAverage(close,26);
MACDHist = MyMACD - XAverage(MyMACD,9);

if MyEMA > MyEMA[1] and MACDHist > MACDHist[1] then begin
Buy("LE") Next Bar ContractsTraded contracts at Market;
end else if MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then begin
sell short("SE") Next Bar ContractsTraded Contracts at Market;
end ; SetStopContract(); //sets the stop loss per contract, alternatively you could use SetStopPosition() to set for the whole position SetStopLoss(SL);

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to ShadowFox for this post:
 
(login for full post details)
  #15 (permalink)
sixhundread
Vienna and Austria
 
 
Posts: 36 since Jul 2021
Thanks: 21 given, 7 received


artisanpro View Post
Your suggestion of "or" will work as well but will give a different result


inputs:
length(13);

vars:
MyEMA(0),
MyMACD(0),
MACDHist(0);

MyEMA = XAverage(close,length);
MyMACD = XAverage(close,12) - XAverage(close,26);
MACDHist = MyMACD - XAverage(MyMACD,9);

{ these 2 lines are not used
Value1 = High;
Value2 = Low;
}

{
// initial code by
if marketPosition = 0 and MyEMA > MyEMA[1] and MACDHist > MACDHist[1] Then
Buy next bar at Open;

if marketposition = 1 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Sell next bar at Open;

if Marketposition = 0 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Sellshort 1 contract next bar at open;

if Marketposition = -1 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Buy to Cover next bar at Open;
}

// is this what you mean with the "OR"
// well, that would work as well but will give a different result
// which I can't test reliably for now
if marketPosition = 0 and MyEMA > MyEMA[1] and MACDHist > MACDHist[1] Then
Buy 1 contract next bar at Open;

if marketposition = 1 and MyEMA < MyEMA[1] OR MACDHist < MACDHist[1] then
Sell 1 contract next bar at Open;

if Marketposition = 0 and MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then
Sellshort 1 contract next bar at open;

if Marketposition = -1 and MyEMA < MyEMA[1] OR MACDHist < MACDHist[1] then
Buy to Cover 1 contract next bar at Open;




yes thats what i mean. i think the elder empulse system works like this. it should exit the position even when one of the 2 signals are not true anymore!


lg

Reply With Quote
 
(login for full post details)
  #16 (permalink)
artisanpro
toronto canada
 
 
Posts: 19 since May 2021
Thanks: 20 given, 9 received

This link will provide you with many Elders system in Easy Language / Power Language:
https://www.multicharts.com/discussion/viewtopic.php?t=2679

Reply With Quote
 
(login for full post details)
  #17 (permalink)
sixhundread
Vienna and Austria
 
 
Posts: 36 since Jul 2021
Thanks: 21 given, 7 received


ShadowFox View Post
There is no need to sell and sell short with the same conditions. If you sell short and you are long, tradestation will close the long and sell short (reverse the position). You just need to sell short or buy to change directions.

Here is an example
Disclaimer: I would not trade this system. This is purely hypothetical to show EasyLanguage code. I am in no way saying this is profitable or not.

 
Code
inputs:
length(13),
ContractsTraded(1),
SL(900)//amount of SL
;

vars:
MyEMA(0),
MyMACD(0),
MACDHist(0);

MyEMA = XAverage(close,length);
MyMACD = XAverage(close,12) - XAverage(close,26);
MACDHist = MyMACD - XAverage(MyMACD,9);

if MyEMA > MyEMA[1] and MACDHist > MACDHist[1] then begin
Buy("LE") Next Bar ContractsTraded contracts at Market;
end else if MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then begin
sell short("SE") Next Bar ContractsTraded Contracts at Market;
end ; SetStopContract(); //sets the stop loss per contract, alternatively you could use SetStopPosition() to set for the whole position SetStopLoss(SL);


yes

Reply With Quote
 
(login for full post details)
  #18 (permalink)
sixhundread
Vienna and Austria
 
 
Posts: 36 since Jul 2021
Thanks: 21 given, 7 received


ShadowFox View Post
There is no need to sell and sell short with the same conditions. If you sell short and you are long, tradestation will close the long and sell short (reverse the position). You just need to sell short or buy to change directions.

Here is an example
Disclaimer: I would not trade this system. This is purely hypothetical to show EasyLanguage code. I am in no way saying this is profitable or not.

 
Code
inputs:
length(13),
ContractsTraded(1),
SL(900)//amount of SL
;

vars:
MyEMA(0),
MyMACD(0),
MACDHist(0);

MyEMA = XAverage(close,length);
MyMACD = XAverage(close,12) - XAverage(close,26);
MACDHist = MyMACD - XAverage(MyMACD,9);

if MyEMA > MyEMA[1] and MACDHist > MACDHist[1] then begin
Buy("LE") Next Bar ContractsTraded contracts at Market;
end else if MyEMA < MyEMA[1] and MACDHist < MACDHist[1] then begin
sell short("SE") Next Bar ContractsTraded Contracts at Market;
end ; SetStopContract(); //sets the stop loss per contract, alternatively you could use SetStopPosition() to set for the whole position SetStopLoss(SL);

if you would not trade this system, what system would you trade?

Reply With Quote
 
(login for full post details)
  #19 (permalink)
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
 
ShadowFox's Avatar
 
Posts: 116 since Jun 2020
Thanks: 69 given, 156 received


sixhundread View Post
if you would not trade this system, what system would you trade?

I just don't know anything about it. I have not researched it, studied it, backtested it, forward tested it, watched it live, and I don't plan to. Not saying it might not work, just I know it will not work for me because I have worked with EMA, MACD, etc. I was just helping you get the code going.

If you want to find out what works, I suggest you get really good at coding so you can test all your idea's. You may need to test 10,000 different ideas before finding the one that is right for you.

Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to ShadowFox for this post:
 
(login for full post details)
  #20 (permalink)
esftrader
Kansas City, MO
 
 
Posts: 1 since Sep 2021
Thanks: 0 given, 0 received


Could anyone help me convert the following thinkScript code to EL? The script is for an indicator called 'Swing Arm'. Can't seem to find a solution anywhere for this.

 
Code
#Swing Arm
input trailType = {default modified, unmodified};
input ATRPeriod = 28;
input ATRFactor = 5;
input firstTrade = {default long, short};

def averageType = AverageType.wilders;

input fib1Level = 61.8;
input fib2Level = 78.6;
input fib3Level = 88.6;

Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
    then high - close[1]
    else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
    then close[1] - low
    else (close[1] - low) - 0.5 * (low[1] - high);

def trueRange;
switch (trailType) {
case modified:
    trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
    trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
    if (!IsNaN(loss)) {
        switch (firstTrade) {
        case long:
            state = state.long;
            trail = close - loss;
        case short:
            state = state.short;
            trail = close + loss;
    }
    } else {
        state = state.init;
        trail = Double.NaN;
    }
case long:
    if (close > trail[1]) {
        state = state.long;
        trail = Max(trail[1], close - loss);
    } else {
        state = state.short;
        trail = close + loss;
    }
case short:
    if (close < trail[1]) {
        state = state.short;
        trail = Min(trail[1], close + loss);
    } else {
        state = state.long;
        trail = close - loss;
    }
}

def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE);

def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE);

def ex = if BuySignal then high else if SellSignal then low else if state == state.long then Max(ex[1], high) else if state == state.short then Min(ex[1], low) else ex[1];

plot TrailingStop = trail;

TrailingStop.SetPaintingStrategy(PaintingStrategy.LINE);
TrailingStop.DefineColor("Long", Color.GREEN);
TrailingStop.DefineColor("Short", Color.RED);
TrailingStop.AssignValueColor(if state == state.long
    then TrailingStop.Color("Long")
    else TrailingStop.Color("Short"));


plot Extremum = ex;
Extremum.SetPaintingStrategy(PaintingStrategy.DASHES);
Extremum.DefineColor("HH", CreateColor(0, 50, 0));
Extremum.DefineColor("LL", CreateColor(50, 0, 0));
Extremum.AssignValueColor(if state == state.long
    then Extremum.Color("HH")
    else Extremum.Color("LL"));
#Extremum.Hide();

def f1 = ex + (trail - ex) * fib1Level / 100;
def f2 = ex + (trail - ex) * fib2Level / 100;
def f3 = ex + (trail - ex) * fib3Level / 100;
def l100 = trail + 0;

plot Fib1 = f1;
Fib1.SetPaintingStrategy(PaintingStrategy.POINTS);
Fib1.SetDefaultColor(Color.BLACK);
Fib1.Hide();

plot Fib2 = f2;
Fib2.SetPaintingStrategy(PaintingStrategy.POINTS);
Fib2.SetDefaultColor(Color.BLACK);
Fib2.Hide();

plot Fib3 = f3;
Fib3.SetPaintingStrategy(PaintingStrategy.POINTS);
Fib3.SetDefaultColor(Color.BLACK);
Fib3.Hide();


def l1 = state[1] == state.long and close crosses below f1[1];
def l2 = state[1] == state.long and close crosses below f2[1];
def l3 = state[1] == state.long and close crosses below f3[1];
def s1 = state[1] == state.short and close crosses above f1[1];
def s2 = state[1] == state.short and close crosses above f2[1];
def s3 = state[1] == state.short and close crosses above f3[1];

def atr = Average(TrueRange(high, close, low), 14);

plot LS1 = if l1 then low - atr else Double.NaN;
plot LS2 = if l2 then low - 1.5 * atr else Double.NaN;
plot LS3 = if l3 then low - 2 * atr else Double.NaN;
plot SS1 = if s1 then high + atr else Double.NaN;
plot SS2 = if s2 then high + 1.5 * atr else Double.NaN;
plot SS3 = if s3 then high + 2 * atr else Double.NaN;

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > EasyLanguage Programmers! I need your HELP!


Last Updated on September 2, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts