Forex_Strategy_Builder.IndicatorSlot.Clone C# (CSharp) Method

Clone() public method

Returns a copy
public Clone ( ) : IndicatorSlot
return IndicatorSlot
        public IndicatorSlot Clone()
        {
            IndicatorSlot slot = new IndicatorSlot();
            slot.slotNumb         = slotNumb;
            slot.slotType         = slotType;
            slot.slotStatus       = slotStatus;
            slot.group            = group;
            slot.isDefined        = isDefined;
            slot.indicatorName    = indicatorName;
            slot.isSeparatedChart = isSeparatedChart;
            slot.minValue         = minValue;
            slot.maxValue         = maxValue;
            slot.indicatorParam   = indicatorParam.Clone();

            slot.adSpecValue = new double[adSpecValue.Length];
            adSpecValue.CopyTo(slot.adSpecValue, 0);

            slot.component = new IndicatorComp[component.Length];
            for (int i = 0; i < component.Length; i++)
                slot.component[i] = component[i].Clone();

            return slot;
        }

Usage Example

示例#1
0
        /// <summary>
        /// Duplicates an logic condition.
        /// </summary>
        public void DuplicateFilter(int slotToDuplicate)
        {
            Data.Log("Duplicate a Filter");

            if (Slot[slotToDuplicate].SlotType == SlotTypes.OpenFilter && OpenFilters < MaxOpenFilters ||
                Slot[slotToDuplicate].SlotType == SlotTypes.CloseFilter && CloseFilters < MaxCloseFilters)
            {
                IndicatorSlot tempSlot = Slot[slotToDuplicate].Clone();

                if (Slot[slotToDuplicate].SlotType == SlotTypes.OpenFilter)
                {
                    int iAddedslot = AddOpenFilter();
                    Slot[iAddedslot] = tempSlot.Clone();
                }

                if (Slot[slotToDuplicate].SlotType == SlotTypes.CloseFilter)
                {
                    int addedslot = AddCloseFilter();
                    Slot[addedslot] = tempSlot.Clone();
                }

                // Sets the slot numbers.
                for (int slot = 0; slot < Slots; slot++)
                {
                    indicatorSlot[slot].SlotNumber = slot;
                }
            }

            return;
        }
All Usage Examples Of Forex_Strategy_Builder.IndicatorSlot::Clone