millionchart
فارسی

Trade setups reference

The 5 functions and 0 values of setup: signature, effects, phase, cost and tested examples.

Declare a trade idea an indicator has: a side, an entry, a stop and a target. The chart draws each one as a Long or Short position, with the zone the price has reached shown stronger. Nothing here places an order.

Functions#

setup.close#

setup.close([setup], [state])

Closes a running setup at the current bar with a result: hit_target, hit_stop, expired or cancelled. A setup that is never closed is read from the bars by the chart.

  • Effects: draws on the chart or writes an output.
  • Phase: every bar.
  • Cost: counts against the limits on drawn objects and outputs.

setup.delete#

setup.delete([setup])

Removes the setup from the chart.

  • Effects: draws on the chart or writes an output.
  • Phase: every bar.
  • Cost: counts against the limits on drawn objects and outputs.

setup.new#

setup.new([side], [entry], [stop], [target], [start], [text])

Declares a trade setup: side is long or short, then the entry; stop and target are named. The levels must make a trade (a long needs stop < entry < target, a short the reverse), otherwise the call gives na and a warning. start is the bar it begins on (the current bar when left out); text is a short note shown on it.

  • Effects: draws on the chart or writes an output; builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds; counts against the limits on drawn objects and outputs.
  • Returns: a setup.

setup.set_stop#

setup.set_stop([setup], [stop])

Moves the stop of a setup that is still running, not past the entry.

  • Effects: draws on the chart or writes an output.
  • Phase: every bar.
  • Cost: counts against the limits on drawn objects and outputs.

setup.set_target#

setup.set_target([setup], [target])

Moves the target of a setup that is still running, not past the entry.

  • Effects: draws on the chart or writes an output.
  • Phase: every bar.
  • Cost: counts against the limits on drawn objects and outputs.