Skip to content

Instantly share code, notes, and snippets.

@rinukkusu
Last active December 9, 2020 13:23
Show Gist options
  • Save rinukkusu/862e5a0816ca5b9327d17046c977a5ae to your computer and use it in GitHub Desktop.
Save rinukkusu/862e5a0816ca5b9327d17046c977a5ae to your computer and use it in GitHub Desktop.
QuantScript (ProQuant) to PineScript (TradingView) conversion
EntryTime Direction Quantity EntryPrice ExitTime ExitPrice Interest Result ReasonForClosing Balance
2020-12-07T09:35:00.000Z LONG 68.69 3681.2 0 -39.78 10422.52
2020-12-07T07:35:00.000Z SHORT 67.57 3688.2 2020-12-07T08:15:00.000Z 3685.5 0 150.95 Exit Rule 10462.3
2020-12-07T02:50:00.000Z LONG 68.32 3691.7 2020-12-07T07:25:00.000Z 3689.5 0 -124.37 Exit Rule 10311.35
2020-12-04T20:00:00.000Z LONG 68.29 3693.5 2020-12-04T20:45:00.000Z 3693.5 0 0 Exit Rule 10435.71
2020-12-04T19:35:00.000Z LONG 67.46 3689 2020-12-04T19:45:00.000Z 3691.5 0 139.54 Exit Rule 10435.71
2020-12-04T16:00:00.000Z SHORT 67.16 3689.5 2020-12-04T19:00:00.000Z 3688.7 0 44.46 Exit Rule 10296.17
2020-12-04T14:25:00.000Z LONG 66.3 3675.2 2020-12-04T14:40:00.000Z 3678.3 0 170.06 Exit Rule 10251.71
2020-12-04T09:25:00.000Z SHORT 66.14 3674 2020-12-04T13:55:00.000Z 3673.5 0 27.36 Exit Rule 10081.65
2020-12-04T06:25:00.000Z LONG 65.68 3673.7 2020-12-04T08:10:00.000Z 3675 0 70.65 Exit Rule 10054.29
2020-12-03T23:40:00.000Z LONG 65.6 3672.5 2020-12-04T05:40:00.000Z 3672.8 0 16.28 Exit Rule 9983.64
2020-12-03T18:50:00.000Z LONG 62.9 3670 2020-12-03T20:15:00.000Z 3678 0 416.36 Exit Rule 9967.36
2020-12-03T10:25:00.000Z LONG 61.62 3664.2 2020-12-03T13:00:00.000Z 3668.3 0 209.04 Exit Rule 9551
2020-12-03T03:25:00.000Z SHORT 59.31 3671 2020-12-03T04:40:00.000Z 3664.2 0 333.71 Exit Rule 9341.95
2020-12-02T20:05:00.000Z LONG 60.23 3669.2 2020-12-03T01:50:00.000Z 3667 -25.5 -135.13 Exit Rule 9008.25
2020-12-02T16:10:00.000Z SHORT 60.98 3658 2020-12-02T18:45:00.000Z 3659.7 0 -85.78 Exit Rule 9143.37
2020-12-02T07:30:00.000Z SHORT 59.72 3653.3 2020-12-02T08:10:00.000Z 3649.2 0 202.6 Exit Rule 9229.15
2020-12-01T16:15:00.000Z SHORT 58.65 3667.8 2020-12-01T20:05:00.000Z 3665.2 0 126.17 Exit Rule 9026.55
2020-12-01T14:00:00.000Z LONG 58.35 3660.5 2020-12-01T14:55:00.000Z 3661.8 0 62.76 Exit Rule 8900.38
2020-11-30T16:05:00.000Z LONG 54.04 3610.7 2020-11-30T21:30:00.000Z 3627.8 0 764.61 Exit Rule 8837.62
2020-11-30T13:35:00.000Z SHORT 53.84 3624 2020-11-30T14:45:00.000Z 3624 0 0 Exit Rule 8073.01
2020-11-30T09:40:00.000Z SHORT 53.83 3618.8 2020-11-30T11:35:00.000Z 3618.5 0 13.36 Exit Rule 8073.01
2020-11-30T00:20:00.000Z SHORT 50.49 3632.3 2020-11-30T04:10:00.000Z 3621 0 472.08 Exit Rule 8059.65
2020-11-27T17:40:00.000Z LONG 48.09 3632.2 2020-11-29T23:00:00.000Z 3642.8 -61.1 360.73 Exit Rule 7587.57
2020-11-27T13:20:00.000Z SHORT 47.83 3636 2020-11-27T16:55:00.000Z 3635.2 0 31.66 Exit Rule 7226.84
2020-11-27T12:20:00.000Z LONG 47.87 3636.5 2020-11-27T13:00:00.000Z 3636.3 0 -7.92 Exit Rule 7195.18
2020-11-26T09:35:00.000Z LONG 51.74 3632.7 2020-11-27T03:55:00.000Z 3619.8 -21.9 -574.16 Exit Rule 7203.1
2020-11-26T05:05:00.000Z LONG 50.55 3632.7 2020-11-26T07:45:00.000Z 3637 0 179.85 Exit Rule 7777.26
2020-11-25T10:20:00.000Z LONG 52.99 3633.2 2020-11-25T17:45:00.000Z 3624.8 0 -368.3 Exit Rule 7597.4
2020-11-25T08:55:00.000Z SHORT 52.45 3630.5 2020-11-25T09:30:00.000Z 3628.5 0 86.8 Exit Rule 7965.7
2020-11-24T20:55:00.000Z LONG 51.54 3634.5 2020-11-24T21:35:00.000Z 3637.5 0 127.94 Exit Rule 7878.91
2020-11-24T13:35:00.000Z LONG 50.11 3606.7 2020-11-24T15:45:00.000Z 3613.3 0 273.65 Exit Rule 7750.97
2020-11-24T07:30:00.000Z LONG 49.43 3601.9 2020-11-24T08:25:00.000Z 3604.6 0 110.43 Exit Rule 7477.32
2020-11-23T16:55:00.000Z LONG 45.79 3556.8 2020-11-23T19:55:00.000Z 3573.4 0 628.94 Exit Rule 7366.89
2020-11-23T16:05:00.000Z SHORT 42.36 3568.4 2020-11-23T16:15:00.000Z 3554.6 0 483.69 Exit Rule 6737.95
2020-11-23T12:15:00.000Z LONG 39.57 3571.8 2020-11-23T14:50:00.000Z 3584.2 0 405.99 Exit Rule 6254.27
2020-11-23T07:50:00.000Z SHORT 40.88 3567.1 2020-11-23T11:35:00.000Z 3572.6 0 -186.04 Exit Rule 5848.28
2020-11-20T21:30:00.000Z LONG 36.91 3544.3 2020-11-23T06:05:00.000Z 3566.2 -46.9 621.97 Exit Rule 6034.32
2020-11-20T20:15:00.000Z SHORT 35.58 3560.4 2020-11-20T21:00:00.000Z 3554.6 0 170.75 Exit Rule 5412.35
2020-11-20T18:55:00.000Z SHORT 34.71 3571.2 2020-11-20T20:05:00.000Z 3567.3 0 112.01 Exit Rule 5241.6
2020-11-20T09:20:00.000Z SHORT 36.6 3565.2 2020-11-20T13:45:00.000Z 3574.1 0 -269.52 Exit Rule 5129.59
2020-11-20T03:55:00.000Z LONG 35.42 3556.3 2020-11-20T04:40:00.000Z 3562.7 0 187.57 Exit Rule 5399.11
2020-11-20T00:15:00.000Z LONG 34.76 3555.8 2020-11-20T03:05:00.000Z 3559.2 0 97.79 Exit Rule 5211.55
2020-11-19T18:45:00.000Z SHORT 35.59 3560.7 2020-11-19T21:55:00.000Z 3565.1 0 -129.57 Exit Rule 5113.76
2020-11-19T09:25:00.000Z LONG 34.6 3550.6 2020-11-19T11:45:00.000Z 3556.2 0 160.32 Exit Rule 5243.33
2020-11-19T06:05:00.000Z SHORT 33.45 3566.9 2020-11-19T08:20:00.000Z 3561.6 0 146.69 Exit Rule 5083.01
2020-11-19T04:30:00.000Z LONG 32.5 3562.8 2020-11-19T05:40:00.000Z 3568.2 0 145.21 Exit Rule 4936.32
2020-11-18T17:30:00.000Z SHORT 31.69 3611.7 2020-11-18T18:00:00.000Z 3609.6 0 55.06 Exit Rule 4791.1
2020-11-18T09:10:00.000Z SHORT 32.4 3602.5 2020-11-18T14:55:00.000Z 3606 0 -93.83 Exit Rule 4736.04
2020-11-18T01:40:00.000Z LONG 31.2 3599.2 2020-11-18T08:25:00.000Z 3606.3 0 183.29 Exit Rule 4829.87
2020-11-17T11:30:00.000Z LONG 29.01 3605.2 2020-11-17T19:15:00.000Z 3618.5 0 319.25 Exit Rule 4646.58
2020-11-16T23:00:00.000Z SHORT 27.86 3627.8 2020-11-17T00:20:00.000Z 3621.5 0 145.23 Exit Rule 4327.33
2020-11-16T15:20:00.000Z LONG 25.75 3609.2 2020-11-16T21:00:00.000Z 3625 0 336.64 Exit Rule 4182.1
2020-11-16T12:20:00.000Z SHORT 23.42 3621.8 2020-11-16T14:35:00.000Z 3604.5 0 335.24 Exit Rule 3845.47
2020-11-16T08:45:00.000Z LONG 22.86 3614.2 2020-11-16T12:00:00.000Z 3619 0 90.79 Exit Rule 3510.22
2020-11-13T17:00:00.000Z LONG 21.92 3564 2020-11-13T19:25:00.000Z 3574.3 0 186.81 Exit Rule 3419.43
2020-11-13T05:05:00.000Z SHORT 24.88 3534.3 2020-11-13T14:15:00.000Z 3554 0 -405.55 Exit Rule 3232.62
2020-11-12T23:40:00.000Z SHORT 24.52 3534.3 2020-11-13T00:45:00.000Z 3531.7 0 52.75 Exit Rule 3638.17
2020-11-12T18:10:00.000Z LONG 23.76 3531 2020-11-12T21:05:00.000Z 3536.8 0 114.03 Exit Rule 3585.42
2020-11-12T15:50:00.000Z SHORT 21.61 3560.3 2020-11-12T17:30:00.000Z 3544.2 0 287.88 Exit Rule 3471.39
2020-11-12T13:30:00.000Z LONG 20.64 3554.7 2020-11-12T15:45:00.000Z 3563.3 0 146.87 Exit Rule 3183.52
2020-11-12T09:05:00.000Z LONG 19.61 3550.7 2020-11-12T09:50:00.000Z 3560.3 0 155.77 Exit Rule 3036.65
2020-11-11T20:40:00.000Z LONG 20.82 3561.7 2020-11-12T05:30:00.000Z 3551.3 -8.8 -187.97 Exit Rule 2880.88
2020-11-11T07:45:00.000Z SHORT 22.33 3548.8 2020-11-11T14:35:00.000Z 3560.2 0 -210.63 Exit Rule 3068.85
2020-11-11T05:45:00.000Z LONG 21.23 3543.5 2020-11-11T06:40:00.000Z 3553 0 166.88 Exit Rule 3279.48
2020-11-11T03:30:00.000Z SHORT 20.18 3551.5 2020-11-11T05:40:00.000Z 3542.7 0 146.94 Exit Rule 3112.6
2020-11-10T21:55:00.000Z SHORT 19.56 3544.3 2020-11-11T00:00:00.000Z 3538.5 3.3 97.18 Exit Rule 2965.66
2020-11-10T11:40:00.000Z LONG 19.3 3542 2020-11-10T15:05:00.000Z 3544.5 0 39.92 Exit Rule 2868.48
2020-11-10T03:40:00.000Z SHORT 22.44 3516 2020-11-10T10:15:00.000Z 3539.5 0 -436.33 Exit Rule 2828.56
2020-11-09T19:15:00.000Z SHORT 21.1 3603 2020-11-09T19:25:00.000Z 3596.2 0 118.72 Exit Rule 3264.89
2020-11-09T16:15:00.000Z LONG 19.05 3595.7 2020-11-09T17:40:00.000Z 3615.5 0 312.1 Exit Rule 3146.17
2020-11-09T10:35:00.000Z LONG 15.71 3554.2 2020-11-09T11:50:00.000Z 3594.5 0 523.85 Exit Rule 2834.08
2020-11-09T05:05:00.000Z SHORT 15.28 3561.3 2020-11-09T05:55:00.000Z 3556.7 0 58.16 Exit Rule 2310.23
2020-11-06T21:30:00.000Z LONG 14.68 3506.7 2020-11-08T23:05:00.000Z 3518.3 -18.6 122.26 Exit Rule 2252.07
2020-11-06T14:15:00.000Z LONG 14.38 3509.5 2020-11-06T20:50:00.000Z 3513 0 41.64 Exit Rule 2129.8
2020-11-06T10:25:00.000Z LONG 13.07 3469.5 2020-11-06T13:35:00.000Z 3489 0 210.88 Exit Rule 2088.16
2020-11-06T07:45:00.000Z SHORT 12.19 3489.8 2020-11-06T09:05:00.000Z 3478.2 0 117 Exit Rule 1877.28
2020-11-06T04:15:00.000Z LONG 11.6 3480.2 2020-11-06T07:25:00.000Z 3489.5 0 89.26 Exit Rule 1760.28
2020-11-06T03:30:00.000Z SHORT 11.11 3487.3 2020-11-06T04:05:00.000Z 3480 0 67.11 Exit Rule 1671.02
2020-11-05T08:35:00.000Z SHORT 11.54 3481.8 2020-11-05T14:10:00.000Z 3488 0 -59.2 Exit Rule 1603.91
2020-11-05T03:55:00.000Z LONG 11.41 3465 2020-11-05T05:55:00.000Z 3467.8 0 26.43 Exit Rule 1663.11
2020-11-05T01:55:00.000Z SHORT 11.22 3439.8 2020-11-05T02:20:00.000Z 3435.5 0 39.92 Exit Rule 1636.68
2020-11-04T10:15:00.000Z SHORT 10.51 3375 2020-11-04T10:35:00.000Z 3360.2 0 128.7 Exit Rule 1596.76
2020-11-04T04:25:00.000Z SHORT 8.26 3404.5 2020-11-04T07:30:00.000Z 3360 0 304.14 Exit Rule 1468.05
2020-11-04T02:30:00.000Z LONG 7.29 3349.5 2020-11-04T03:00:00.000Z 3374.8 0 152.61 Exit Rule 1163.92
2020-11-04T00:30:00.000Z SHORT 5.66 3385.8 2020-11-04T01:00:00.000Z 3339.2 0 218.24 Exit Rule 1011.31
2020-11-03T16:10:00.000Z SHORT 5.08 3375.3 2020-11-03T18:50:00.000Z 3355.7 0 82.38 Exit Rule 793.07
2020-11-03T05:30:00.000Z LONG 5.07 3320.5 2020-11-03T08:25:00.000Z 3323.8 0 13.84 Exit Rule 710.69
2020-11-02T18:35:00.000Z LONG 4.5 3285.2 2020-11-02T23:40:00.000Z 3308.5 -1.9 84.85 Exit Rule 696.84
2020-11-02T16:25:00.000Z SHORT 4.37 3297.3 2020-11-02T17:45:00.000Z 3293 0 15.55 Exit Rule 611.99
2020-11-02T14:10:00.000Z LONG 4.04 3300.5 2020-11-02T15:05:00.000Z 3313.8 0 44.46 Exit Rule 596.44
2020-11-02T09:45:00.000Z SHORT 3.99 3302.8 2020-11-02T12:55:00.000Z 3301 0 5.94 Exit Rule 551.98
2020-11-02T01:00:00.000Z LONG 3.69 3253.2 2020-11-02T01:40:00.000Z 3269 0 48.24 Exit Rule 546.04
2020-11-01T22:25:00.000Z SHORT 3.3 3277.8 2020-11-01T23:35:00.000Z 3259.5 0 49.97 Exit Rule 497.8
2020-10-30T18:50:00.000Z LONG 2.88 3238.7 2020-10-30T20:00:00.000Z 3264.5 0 61.48 Exit Rule 447.83
2020-10-30T14:45:00.000Z SHORT 2.71 3238.7 2020-10-30T18:45:00.000Z 3228.5 0 22.87 Exit Rule 386.35
2020-10-30T06:15:00.000Z LONG 2.46 3231.2 2020-10-30T07:40:00.000Z 3248 0 34.2 Exit Rule 363.48
2020-10-29T22:40:00.000Z LONG 3.14 3266.2 2020-10-30T06:05:00.000Z 3229.2 0 -96.13 Stop Loss 329.28
2020-10-29T11:05:00.000Z SHORT 2.88 3282.3 2020-10-29T11:40:00.000Z 3268 0 34.08 Exit Rule 425.41
2020-10-29T00:40:00.000Z SHORT 2.83 3288.3 2020-10-29T07:35:00.000Z 3285.7 0 6.09 Exit Rule 391.34
2020-10-28T22:30:00.000Z LONG 2.73 3280.5 2020-10-29T00:10:00.000Z 3286.5 0 13.55 Exit Rule 385.25
2020-10-28T08:25:00.000Z LONG 3.59 3335.7 2020-10-28T14:15:00.000Z 3293.7 0 -124.76 Stop Loss 371.7
2020-10-27T14:10:00.000Z LONG 4.43 3399 2020-10-28T05:25:00.000Z 3365 -1.9 -126.5 Exit Rule 496.45
2020-10-27T11:40:00.000Z SHORT 4.3 3408.3 2020-10-27T12:45:00.000Z 3404 0 15.3 Exit Rule 622.96
2020-10-27T09:25:00.000Z LONG 4.12 3395.7 2020-10-27T10:35:00.000Z 3403.8 0 27.61 Exit Rule 607.66
2020-10-27T05:20:00.000Z SHORT 4.11 3399.3 2020-10-27T08:10:00.000Z 3398.7 0 2.04 Exit Rule 580.04
2020-10-26T16:00:00.000Z LONG 3.93 3386.7 2020-10-26T20:00:00.000Z 3394.8 0 26.34 Exit Rule 578
2020-10-26T15:05:00.000Z SHORT 3.77 3390 2020-10-26T15:20:00.000Z 3383 0 21.84 Exit Rule 551.66
2020-10-26T13:35:00.000Z LONG 3.72 3424.5 2020-10-26T13:40:00.000Z 3425.3 0 2.46 Exit Rule 529.83
2020-10-26T10:50:00.000Z SHORT 3.67 3418.3 2020-10-26T12:15:00.000Z 3415.7 0 7.9 Exit Rule 527.37
2020-10-25T23:15:00.000Z LONG 3.57 3437.7 2020-10-26T01:15:00.000Z 3441.3 0 10.63 Exit Rule 519.47
2020-10-23T15:00:00.000Z LONG 3.39 3448.2 2020-10-23T20:00:00.000Z 3457 0 24.68 Exit Rule 508.84
2020-10-23T09:05:00.000Z SHORT 3.48 3452 2020-10-23T13:35:00.000Z 3456.7 0 -13.53 Exit Rule 484.15
2020-10-23T06:35:00.000Z LONG 3.29 3442.2 2020-10-23T07:35:00.000Z 3452.5 0 28.04 Exit Rule 497.69
2020-10-23T01:30:00.000Z LONG 3.21 3446.7 2020-10-23T03:00:00.000Z 3450.8 0 10.89 Exit Rule 469.65
2020-10-22T14:45:00.000Z SHORT 4.3 3406.8 2020-10-23T00:05:00.000Z 3448.5 0.7 -147.64 Exit Rule 458.76
2020-10-22T09:25:00.000Z SHORT 4.24 3420.8 2020-10-22T14:25:00.000Z 3419.2 0 5.61 Exit Rule 606.4
2020-10-22T06:20:00.000Z SHORT 4.07 3417.8 2020-10-22T07:15:00.000Z 3410.5 0 24.58 Exit Rule 600.78
2020-10-21T22:30:00.000Z LONG 4.63 3433.8 2020-10-22T05:10:00.000Z 3412.3 0 -82.37 Exit Rule 576.2
2020-10-21T14:00:00.000Z SHORT 4.06 3453.5 2020-10-21T19:50:00.000Z 3430.5 0 77.26 Exit Rule 658.56
2020-10-21T12:55:00.000Z LONG 3.86 3437.5 2020-10-21T13:45:00.000Z 3447.3 0 31.3 Exit Rule 581.3
# Indicators
cci = CommodityChannelIndex(
applyTo: typical,
period: 43
)
teeth = Alligator.Teeth(
applyTo: median,
period: 27,
shift: 13
)
jaws = Alligator.Jaws(
applyTo: median,
period: 22,
shift: 25
)
bollingerUpper = Bollinger.UpperBand(
applyTo: close,
period: 25,
deviation: 2.17
)
bollingerLower = Bollinger.LowerBand(
applyTo: close,
period: 25,
deviation: 2.17
)
# Rules/triggers
longEntryRule = Rises(cci)
longEntryRule2 = CrossesDownwards(
value: teeth,
crosses: jaws
)
shortEntryRule = Falls(cci)
shortEntryRule2 = CrossesUpwards(
value: teeth,
crosses: jaws
)
longExitRule = CrossesUpwards(
value: open,
crosses: bollingerUpper
)
shortExitRule = CrossesDownwards(
value: open,
crosses: bollingerLower
)
# Signals
enter long when longEntryRule and longEntryRule2
enter short when shortEntryRule and shortEntryRule2
exit long when longExitRule
exit short when shortExitRule
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © rinukkusu
//@version=4
strategy("Ecstatic Morgulis", overlay=false)
slPoints = input(title="Stop Loss Trail Points (Pips)",type=input.integer,minval=1,maxval=10000,step=1,defval=51,confirm=false)
slOffset = input(title="Stop Loss Trail Offset (Pips)",type=input.integer,minval=1,maxval=10000,step=1,defval=1,confirm=false)
jaws = sma(close[25], 22)
teeth = sma(close[13], 27)
plot(jaws, color=#0000ff, title="Jaw")
plot(teeth, color=#00ff00, title="Teeth")
// https://docs.proquant.com/docs/variables/typical/
// typical = (high + low + close) / 3
// close seems to perform better here?
cci_data = cci(close, 43)
[bb_middle, bb_upper, bb_lower] = bb(close, 25, 2.17)
// Long Rules
longEntryRule1 = rising(cci_data, 1)
longEntryRule2 = crossunder(teeth, jaws)
longExitRule = crossover(open, bb_upper)
// Short Rules
shortEntryRule1 = falling(cci_data, 1)
shortEntryRule2 = crossover(teeth, jaws)
shortExitRule = crossunder(open, bb_lower)
strategy.entry("Long", strategy.long, when=longEntryRule1 and longEntryRule2)
strategy.entry("Short", strategy.short, when=shortEntryRule1 and shortEntryRule2)
strategy.exit("Long Exit", "Long", when=longExitRule, trail_points=slPoints, trail_offset=slOffset)
strategy.exit("Short Exit", "Short", when=shortExitRule, trail_points=slPoints, trail_offset=slOffset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment