This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=2 | |
study("RSI+MA", overlay=true) | |
// data series for RSI with length 14 | |
rsi = rsi(close, 14) | |
// data series for Moving Average with length 9 | |
ma = sma(close, 9) | |
// data series for buy signals: | |
//price should be below the moving average and RSI should be smaller than 40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Booleans | |
false.ifTrue { assert false }.ifFalse { assert true }; | |
// Exceptions | |
{-> throw new NullPointerException("Buh!") }.on(NullPointerException).do { e -> | |
assert e in Exception | |
assert e in NullPointerException | |
assert !(e in ArithmeticException) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Smalltalk { | |
static Boolean ifTrue (Boolean self, Closure c) { | |
if(self) c() | |
self | |
} | |
static Boolean ifFalse (Boolean self, Closure c) { | |
if(!self) c() | |
self | |
} | |
static Boolean 'do' (Boolean self, Closure c) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PackageLoader fileInPackage: 'Android'. | |
| layout event droid samples | | |
droid := Android new. | |
layout := '<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/background" | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| url con is isr br line content pane frame | | |
<importPackage(java.net)>. | |
<importPackage(java.io)>. | |
url := <new URL('http://www.esvapi.org/v2/rest/passageQuery?key=IP&passage=Psalm+23&include-headings=false')>. | |
con := url openConnection. | |
is := con getInputStream. | |
isr := <new InputStreamReader(is)>. | |
br := <new BufferedReader(isr)>. | |
content := ''. | |
line := ''. |