Skip to content

Instantly share code, notes, and snippets.

View lvca's full-sized avatar

Luca Garulli lvca

View GitHub Profile
@lvca
lvca / wma150-crossover-wma200.js
Last active June 12, 2020 22:03
Arcade Trader strategy to invest when the sma50 line crosses over the sma200 line and sell when the sma50 crosses below sma200 line
function beginTrading(context){
if( History.days().length > 1 ) {
let yesterday = History.last();
let prev = History.relative(-1);
if( yesterday.wma150 >= yesterday.wma200 &&
prev.wma150 < prev.wma200 )
return { invest: true, reason: "wma-150 crossed over wma-200" };
}
}
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java -server -XX:MaxDirectMemorySize=512g -DORIENTDB_HOME=target -Dorientdb.www.path=src/site -Djava.util.logging.config.file=src/resources/orientdb-server0-log.properties -Dorientdb.config.file=${ORIENTDB_HOME}/config/orientdb-dserver-config-0.xml -Drhino.opt.level=9 -Dhazelcast.local.localAddress=127.0.0.1 -Dhazelcast.operation.thread.count=1 -Dhazelcast.operation.generic.thread.count=1 -Dhazelcast.event.thread.count=1 -Dhazelcast.client.event.thread.count=1 -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/j
@lvca
lvca / HACrashTest.java
Created December 7, 2015 18:31
develop test fail
Creating database 'distributed-txhacrash' under: target/server0/databases/distributed-txhacrash...
Creating database schema...
[OServer]
2015-12-07 19:22:27:738 INFO - closing storage: distributed-txhacrash... [Orient]
Starting test against 3 server nodes...
**********************************************************************************************************
STARTING SERVER -> 0...
**********************************************************************************************************
@lvca
lvca / cluster-deadlock-3-servers
Created October 8, 2014 09:33
cluster-deadlock-3-servers
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java -ea -DpropertyName=ORIENTDB_ROOT_PASSWORD -Didea.launcher.port=7532 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13 CE.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 13 CE.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 13 CE.app/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Ja
[java] 2014-07-23 12:52:45
[java] Full thread dump Java HotSpot(TM) 64-Bit Server VM (23.5-b02 mixed mode):
[java]
[java] "DestroyJavaVM" prio=5 tid=0x00007fa50e7f6800 nid=0x1703 waiting on condition [0x0000000000000000]
[java] java.lang.Thread.State: RUNNABLE
[java]
[java] "OrientDB WAL Flush Task (GratefulDeadConcerts)" daemon prio=5 tid=0x00007fa510851800 nid=0xb807 waiting on condition [0x000000011c40e000]
[java] java.lang.Thread.State: TIMED_WAITING (parking)
package com.orientechnologies.orient.core.compression.impl;
import com.orientechnologies.orient.core.compression.OCompression;
import com.orientechnologies.orient.core.compression.OCompressionFactory;
import com.orientechnologies.orient.core.record.impl.ODocument;
import java.util.Random;
/**
* @author Andrey Lomakin
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -server -Xmx1g -DORIENTDB_HOME=/Users/luca/work/dev/orientechnologies/orientdb/releases/orientdb-community-1.7-SNAPSHOT -Dorientdb.www.path=src/site -Djava.util.logging.config.file=/Users/luca/work/dev/orientechnologies/orientdb/misc/src/test/resources/orientdb-server2-log.properties -Dorientdb.config.file=${ORIENTDB_HOME}/config/orientdb-dserver-config.xml -Drhino.opt.level=9 -Didea.launcher.port=7535 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13 CE.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -server -Xmx1g -DORIENTDB_HOME=/Users/luca/work/dev/orientechnologies/orientdb/releases/orientdb-community-1.7-SNAPSHOT -Dorientdb.www.path=src/site -Djava.util.logging.config.file=/Users/luca/work/dev/orientechnologies/orientdb/misc/src/test/resources/orientdb-server1-log.properties -Dorientdb.config.file=${ORIENTDB_HOME}/config/orientdb-dserver-config.xml -Drhino.opt.level=9 -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13 CE.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -server -Xmx1g -DORIENTDB_HOME=/Users/luca/work/dev/orientechnologies/orientdb/releases/orientdb-community-1.7-SNAPSHOT -Dorientdb.www.path=src/site -Djava.util.logging.config.file=/Users/luca/work/dev/orientechnologies/orientdb/misc/src/test/resources/orientdb-server0-log.properties -Dorientdb.config.file=${ORIENTDB_HOME}/config/orientdb-dserver-config.xml -Drhino.opt.level=9 -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13 CE.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
2014-02-24 13:54:38:035 INFO URL=plocal:/Users/luca/work/dev/orientechnologies/orientdb/misc/servers/1/databases/platform [OrientDBCluster]
2014-02-24 13:54:38:037 INFO Starting EXECUTE test against database plocal:/Users/luca/work/dev/orientechnologies/orientdb/misc/servers/1/databases/platform count = 10000 [OrientDBCluster]Current directory: /Users/luca/work/dev/orientechnologies/orientdb/misc/.
2014-02-24 13:54:39:335 INFO Loading configuration from input stream [OServerConfigurationLoaderXml]
2014-02-24 13:54:39:539 INFO OrientDB Server v1.7-rc2-SNAPSHOT is starting up... [OServer]
2014-02-24 13:54:39:549 INFO Databases directory: /Users/luca/work/dev/orientechnologies/orientdb/misc/servers/1/databases [OServer]
2014-02-24 13:54:39:582 INFO Port 0.0.0.0:2424 busy, trying the next available... [OServerNetworkListener]
2014-02-24 13:54:39:583 INFO Listening binary connections on 0.0.0.0:2425 (protocol v.20) [OServerNetworkListener]
2014-02-24 13:54:39:583 INFO Port 0.0.0.0:2480 busy, trying the next avai