Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1036390 // MultiPullbackJuicer maker include

JavaX fragment (include)

// pullback levels for different profits

settableWithVar double profitLevel1 = 0.1;
settableWithVar double keepPercentage1 = 50;
settableWithVar double profitLevel2;
settableWithVar double keepPercentage2;
settableWithVar double profitLevel3;
settableWithVar double keepPercentage3;

// max loss before leverage
settableWithVar double maxLoss = 0.5;

swappable MultiPullbackJuicer makeJuicer() {
  new MultiPullbackJuicer j;
  j.stopLossLimit(-maxLoss);
  j.stopLossEnabled(true);
  for (int i = 1; i <= 3; i++) {
    double profitLevel = toDouble(get(this, "profitLevel" + i));
    double keepPercentage = toDouble(get(this, "keepPercentage" + i));
    if (profitLevel != 0 || keepPercentage != 0)
      j.addLevel(profitLevel, keepPercentage);
  }
  ret j;
}

Author comment

Began life as a copy of #1036358

download  show line numbers  debug dex  old transpilations   

Travelled to 1 computer(s): mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036390
Snippet name: MultiPullbackJuicer maker include
Eternal ID of this version: #1036390/4
Text MD5: 94bd191d6dc0313f9d4a8670deb84616
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-18 03:09:47
Source code size: 784 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 83 / 119
Version history: 3 change(s)
Referenced in: [show references]