Coming from EasyLanguage
A real import, the ideas side by side, and the names that translate.
This is a real run of the importer on a small EasyLanguage script. The result compiles. 6 lines were read: 3 carried over exactly, 3 were adapted and 1 came back as decisions for you.
Inputs: FastLen(20), SlowLen(50);Variables: FastAvg(0), SlowAvg(0);FastAvg = XAverage(Close, FastLen);SlowAvg = XAverage(Close, SlowLen);If FastAvg crosses over SlowAvg then Buy next bar at market;If FastAvg crosses under SlowAvg then Sell next bar at market;1
strategy "Imported EasyLanguage strategy"2
market: EURUSD3
bars: 1h4
5
input FastLen = 206
input SlowLen = 507
8
state FastAvg = 09
state SlowAvg = 010
11
FastAvg = ema(close, FastLen)12
SlowAvg = ema(close, SlowLen)13
14
when crosses_above(FastAvg, SlowAvg):15
buy size: 1 lot16
17
when crosses_below(FastAvg, SlowAvg):18
close_all side: longLine by line
| Status | Your line | What happened |
|---|---|---|
| Exact | FastAvg = XAverage ( Close , FastLen ) ; | a calculation carried over |
| Exact | SlowAvg = XAverage ( Close , SlowLen ) ; | a calculation carried over |
| Exact | Buy next bar at market ; | an order at market carried over |
| Adapted | If FastAvg crosses over SlowAvg then Buy next bar at market ; | a condition that places orders became a rule |
| Adapted | Sell next bar at market ; | sell closed the open position, which became close_all on that side |
| Adapted | If FastAvg crosses under SlowAvg then Sell next bar at market ; | a condition that places orders became a rule |
| Your call | the script header | EasyLanguage carries no market or bar size, so EURUSD on 1h was filled in: set the ones you want |
How the ideas translate
| In EasyLanguage | In AlgoBarsX |
|---|---|
Inputs: FastLen(20); | input FastLen = 20 |
Variables: FastAvg(0); | state FastAvg = 0 |
XAverage(Close, FastLen) | ema(close, FastLen) |
Average, WAverage | sma, wma |
If a crosses over b then … | when crosses_above(a, b): |
Buy next bar at market; | buy. Market orders already fill at the next bar's open. |
Sell next bar at market; | close_all side: long |
CurrentBar | bar.index |
Tip. EasyLanguage variables become
state values. Where one is simply recalculated every bar, you can delete the state line and keep the assignment.Names the importer translates for you
| Their name | AlgoBarsX |
|---|---|
average | sma |
xaverage | ema |
waverage | wma |
stddev | stdev |
standarddev | stdev |
truerange | true_range |
avgtruerange | atr |
absvalue | abs |
maxlist | max |
minlist | min |
squareroot | sqrt |
expvalue | exp |
power | pow |
ceiling | ceil |
linearregvalue | linreg |
c | close |
o | open |
h | high |
l | low |
v | volume |
currentbar | bar.index |
barnumber | bar.index |
pi | 3.14159265 |
range | bar.range |
avgprice | ohlc4 |
medianprice | hl2 |
typicalprice | hlc3 |
Read every import before you run it. Compare the plain-English description with what your original did, settle each decision, and backtest before you deploy.