PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
native_price_grid_c.c File Reference
#include <pineforge/pineforge.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for native_price_grid_c.c:

Go to the source code of this file.

Macros

#define QUARTER_MS   (15LL * 60LL * 1000LL)
 

Enumerations

enum  {
  kBarCount = 6 ,
  kMaxFills = 5 ,
  kMaxEvents = 128
}
 
enum  { kModeCount = 4 }
 

Functions

static void submit (struct host_state *state, uint32_t intent, double value, uint32_t trigger, double price, const char *label)
 
static int on_bar (void *user, const pf_bar_t *bar, const pf_native_decision_v1 *at)
 
static pf_native_run_spec_v1 make_spec (const char *key, double tick)
 
static pf_native_run_spec_ext_v1 make_ext (uint32_t grid, uint32_t rounding)
 
static int run_mode (const struct mode *mode)
 
static int grid_without_a_ladder_is_refused (void)
 
int main (void)
 

Variables

static const pf_bar_t kBars []
 
static const struct mode kModes []
 

Macro Definition Documentation

◆ QUARTER_MS

#define QUARTER_MS   (15LL * 60LL * 1000LL)

Definition at line 20 of file native_price_grid_c.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kBarCount 
kMaxFills 
kMaxEvents 

Definition at line 32 of file native_price_grid_c.c.

◆ anonymous enum

anonymous enum
Enumerator
kModeCount 

Definition at line 151 of file native_price_grid_c.c.

Function Documentation

◆ submit()

◆ on_bar()

◆ make_spec()

◆ make_ext()

◆ run_mode()

◆ grid_without_a_ladder_is_refused()

static int grid_without_a_ladder_is_refused ( void )
static

◆ main()

int main ( void )

Variable Documentation

◆ kBars

const pf_bar_t kBars[]
static
Initial value:
= {
{100.00, 100.20, 99.90, 100.10, 10.0, 0 * QUARTER_MS},
{100.10, 100.30, 100.05, 100.20, 10.0, 1 * QUARTER_MS},
{100.20, 100.80, 100.15, 100.70, 10.0, 2 * QUARTER_MS},
{ 99.40, 99.45, 99.20, 99.30, 10.0, 3 * QUARTER_MS},
{ 99.45, 99.65, 99.35, 99.60, 10.0, 4 * QUARTER_MS},
{ 99.60, 99.62, 99.30, 99.40, 10.0, 5 * QUARTER_MS}
}
#define QUARTER_MS

Definition at line 24 of file native_price_grid_c.c.

◆ kModes

const struct mode kModes[]
static
Initial value:
= {
{"None", 0u, 0u, 3,
{100.10, 100.75, 99.40}, {100.10, 100.75, 99.40}, 2},
{"QuantizeFills/HalfUp", 1u, 0u, 3,
{100.10, 100.75, 99.40}, {100.00, 100.75, 99.50}, 2},
{"QuantizeFills/Directional", 1u, 1u, 3,
{100.10, 100.75, 99.40}, {100.25, 100.75, 99.25}, 2},
{"QuantizeFillsAndTriggers/HalfUp", 2u, 0u, 5,
{100.10, 100.75, 99.40, 99.75, 99.60}, {100.00, 100.75, 99.50, 99.75, 99.50}, 3}
}

Definition at line 141 of file native_price_grid_c.c.

Referenced by main().