Action based buying and selling


Is there a way to generate sell order automatically when buy happen.For example, placing sell order before buying may be limited by margin issue but this can be resolved if the sell order is placed only after buy happens. This might be useful in the instruments where BO and CO are not available. Any desktop based automation suggestion is welcome as well.